[ORACLE] Full Online backup & Recovery

반응형

1. 백업 복구 테스트 전, Data 상황

50번까지는 Archive log로 떨어진 상태
51번 부터는 Redo log에 있는 상황

 

2. 장애 상황 가정 

50번까지 Archilve log로 떨어진  시점에서 Online Fullbackup 후, 장애 발생으로 가정 [Datafile 삭제, 정합성 오류 등]

 

3. Online fullbackup 본으로 DB Recovery 시작

begin backup 후, Copy 된 Control file을 가지고 있던, Control file 재생성 구문으로 재생성을 하던 Backup된 Controlfile은 복구시에 마지막 Checkpoint SCN을 모르기 때문에 아래와 같은 옵션으로 복구를 해야한다. 

backup 된 Controlfile 복구시에는 마지막 checkpoint SCN이 언제가 되는지 모른다. 그래서 datafile의 SCN을 보고 그 이후의 복구자료들 (Archive file, logfile)을 모두 복구하게 되는데
->  USING BACKUP CONTROLFILE 옵션

언제까지 복구할 줄 알 수가 없으므로, 사용자가 CANCEL을 입력할 떄의 시점의 파일전까지 복구를 한다는 의미
-> UNTIL CANCEL옵션
[CASE.1] Begin backup 후, Copy한  컨트롤 파일 백업 유무

1. shutdown abort


2. Online fullbackup 받아놓은 파일을 Datfile위치에 복구한다.
- 백업시점의 Archivelog부터 장애발생 직전까지 있었던 Archive log를 모두 확보한다. [Archivelog Dest에 위치시킨다.]


3. 백업받을때  begin backup 찍고, Copy 한 control file이 있는경우 

4. startup mount

5.  RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL
 - AUTO


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 1821763 generated at 06/09/2022 21:00:50 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_8_1106945068.dbf
ORA-00280: change 1821763 for thread 1 is in sequence #8
ORA-00278: log file '/home/oracle/arch_dest/1_7_1106945068.dbf' no longer
needed for this recovery


ORA-00279: change 1821766 generated at 06/09/2022 21:00:50 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_9_1106945068.dbf
ORA-00280: change 1821766 for thread 1 is in sequence #9
ORA-00278: log file '/home/oracle/arch_dest/1_8_1106945068.dbf' no longer
needed for this recovery


ORA-00279: change 1821837 generated at 06/09/2022 21:00:51 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_10_1106945068.dbf
ORA-00280: change 1821837 for thread 1 is in sequence #10
ORA-00278: log file '/home/oracle/arch_dest/1_9_1106945068.dbf' no longer
needed for this recovery

-----------------------------여기까지 Archive를읽어서 복구했다는 거임-----------------------------------

ORA-00308: cannot open archived log
'/home/oracle/arch_dest/1_10_1106945068.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


6. ALTER DATABASE OPEN RESETLOGS;


 

[CASE.2] Controlfile 재생성 스크립트 백업한 경우 

1. shutdown abort

2. Online fullbackup 받아놓은 파일을 Datfile위치에 복구한다.
- 백업시점의 Archivelog부터 장애발생 직전까지 있었던 Archive log를 모두 확보한다. [Archivelog Dest에 위치시킨다.]

3. 컨트롤 파일 재생성 구문을 백업한 경우

4. startup nomount

5. 컨트롤파일 재생성 

5.  RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL
 - AUTO

SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL
ORA-00279: change 1823773 generated at 06/09/2022 21:31:19 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_5_1106947478.dbf
ORA-00280: change 1823773 for thread 1 is in sequence #5


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 1823806 generated at 06/09/2022 21:32:07 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_6_1106947478.dbf
ORA-00280: change 1823806 for thread 1 is in sequence #6
ORA-00278: log file '/home/oracle/arch_dest/1_5_1106947478.dbf' no longer
needed for this recovery


ORA-00279: change 1823809 generated at 06/09/2022 21:32:07 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_7_1106947478.dbf
ORA-00280: change 1823809 for thread 1 is in sequence #7
ORA-00278: log file '/home/oracle/arch_dest/1_6_1106947478.dbf' no longer
needed for this recovery


ORA-00279: change 1823812 generated at 06/09/2022 21:32:10 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch_dest/1_8_1106947478.dbf
ORA-00280: change 1823812 for thread 1 is in sequence #8
ORA-00278: log file '/home/oracle/arch_dest/1_7_1106947478.dbf' no longer
needed for this recovery

-----------------------------여기까지 Archive를읽어서 복구했다는 거임-----------------------------------

ORA-00308: cannot open archived log '/home/oracle/arch_dest/1_8_1106947478.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3


6. ALTER DATABASE OPEN RESETLOGS;



CASE.1 , CASE.2 모두 RESETLOGS로 복구를 하여서 50번까지 복구됨

반응형

'Database > Oracle' 카테고리의 다른 글

[ORACLE] RMAN Script example  (0) 2022.06.13
[ORACLE] RMAN 명령어  (0) 2022.06.13
[ORACLE] Online backup Script example  (0) 2022.06.09
[ORACLE] SCN  (0) 2022.06.03
[ORACLE] Control file Bakcup&Recovery  (0) 2022.06.03