=> 백업 완료
SQL> select * from v$log;
SQL>
select a.file#, a.name file_name, b.name file_name, b.name tbs_name, a.status, a.checkpoint_change#
from v$datafile a, v$tablespace b
where a.ts# = b.ts#;
SQL> drop table hr.emp_50 purge;
SQL> create table hr.emp_50 as select * from hr.employees where department_id = 50;
SQL> select count(*) from hr.emp_50;
SQL> select * from v$log;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> select * from v$log;
SQL>
SELECT a.group#, b.sequence#, a.member, b.bytes/1024/1024 MB, b.archived, b.status
FROM v$logfile a, v$log b
WHERE a.group#=b.group#
ORDER BY 1;
SQL> ! ls /home/oracle1/arch1
#) data file, control file 위치 확인
SQL> ! ls /u01/app/oracle/oradata/ora11g/*.dbf
SQL> ! ls /u01/app/oracle/oradata/ora11g/system01.dbf
SQL> ! ls /u01/app/oracle/oradata/ora11g/control01.ctl
# 장애 유발 #
SQL> ! rm /u01/app/oracle/oradata/ora11g/system01.dbf
SQL> ! rm /u01/app/oracle/oradata/ora11g/*.ctl
SQL> ! ls /u01/app/oracle/oradata/ora11g/system01.dbf
ls: cannot access /u01/app/oracle/oradata/ora11g/system01.dbf: No such file or directory
SQL> ! ls /u01/app/oracle/oradata/ora11g/*.ctl
ls: cannot access /u01/app/oracle/oradata/ora11g/*.ctl: No such file or directory
# log switch 발생
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> select status from v$instance;
<HR SESSION>
[oracle1@oracle ~]$ sqlplus hr/hr
SQL> shutdown abort
SQL> !
[oracle1@oracle cold_20240117]$ cp -av system01.dbf /u01/app/oracle/oradata/ora11g/
‘system01.dbf’ -> ‘/u01/app/oracle/oradata/ora11g/system01.dbf’
[oracle1@oracle cold_20240117]$ cp -av *.ctl /u01/app/oracle/oradata/ora11g/
‘control01.ctl’ -> ‘/u01/app/oracle/oradata/ora11g/control01.ctl’
[oracle1@oracle cold_20240117]$ sqlplus / as sysdba
SQL> startup mount
ORACLE instance started.
Total System Global Area 711430144 bytes
Fixed Size 1367004 bytes
Variable Size 440402980 bytes
Database Buffers 264241152 bytes
Redo Buffers 5419008 bytes
Database mounted.
# recover 시도
SQL> recover database using backup controlfile
ORA-00279: change 846824 generated at 01/18/2024 01:17:20 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_1_1158542235.arc
ORA-00280: change 846824 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 847951 generated at 01/18/2024 01:31:19 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_2_1158542235.arc
ORA-00280: change 847951 for thread 1 is in sequence #2
ORA-00278: log file '/home/oracle1/arch1/arch_1_1_1158542235.arc' no longer
needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 847954 generated at 01/18/2024 01:31:21 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_3_1158542235.arc
ORA-00280: change 847954 for thread 1 is in sequence #3
ORA-00278: log file '/home/oracle1/arch1/arch_1_2_1158542235.arc' no longer
needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 847958 generated at 01/18/2024 01:31:27 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_4_1158542235.arc
ORA-00280: change 847958 for thread 1 is in sequence #4
ORA-00278: log file '/home/oracle1/arch1/arch_1_3_1158542235.arc' no longer
needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 848046 generated at 01/18/2024 01:34:01 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_5_1158542235.arc
ORA-00280: change 848046 for thread 1 is in sequence #5
ORA-00278: log file '/home/oracle1/arch1/arch_1_4_1158542235.arc' no longer
needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 848062 generated at 01/18/2024 01:34:44 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_6_1158542235.arc
ORA-00280: change 848062 for thread 1 is in sequence #6
ORA-00278: log file '/home/oracle1/arch1/arch_1_5_1158542235.arc' no longer
needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log
'/home/oracle1/arch1/arch_1_6_1158542235.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
# recover 다시 시도
=> trace 에서 확인
Thu Jan 18 01:34:01 2024
Archived Log entry 13 added for thread 1 sequence 4 ID 0xf7b0367 dest 1:
Thu Jan 18 01:34:44 2024
Beginning log switch checkpoint up to RBA [0x6.2.10], SCN: 848062
Thread 1 advanced to log sequence 6 (LGWR switch)
Current log# 9 seq# 6 mem# 0: /u01/app/oracle/oradata/ora11g/redo09.log
tip) change 846468 generated at 01/18/2024 01:01:03 needed for thread 1
날짜/ 시간대를 보고 찾으면 금방 찾을 수 있다!
SQL> recover database using backup controlfile
ORA-00279: change 846468 generated at 01/18/2024 01:01:03 needed for thread 1
ORA-00289: suggestion : /home/oracle1/arch1/arch_1_7_1158531164.arc
ORA-00280: change 846468 for thread 1 is in sequence #7
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/ora11g/redo09.log <<- current 한 redo log file 찾아서 직접 filename 으로 적용
Log applied.
Media recovery complete.
SQL> alter database open resetlogs;
SQL> select count(*) from hr.emp_50;
SQL> select * from v$log;
'Backup > Archive Log Mode' 카테고리의 다른 글
undo Data file 장애 발생했을 경우 (0) | 2024.01.18 |
---|---|
redo log file, control file 손상되었을 경우 (0) | 2024.01.18 |
data file, control file 손상되었을 경우 (0) | 2024.01.18 |
data file, redo log file 손상되지 않고 control file 손상되었을 경우 (0) | 2024.01.18 |
control file 손상 되었을 경우.(control file 의 백업 file 있을 때) (0) | 2024.01.18 |