Oracle的redo log在各场景下的恢复(7)

SQL> alter database open resetlogs;
 alter database open resetlogs
 *
 ERROR at line 1:
 ORA-01139: RESETLOGS option only valid after an incomplete database recovery


 SQL> recover database until cancel;
 ORA-00283: recovery session canceled due to errors
 ORA-00600: internal error code, arguments: [2130], [0], [8], [2], [], [], [], []


 SQL> show parameter resetlog

NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 _allow_resetlogs_corruption boolean TRUE
 SQL> show parameter allow

NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 _allow_error_simulation boolean TRUE
 _allow_resetlogs_corruption boolean TRUE
 SQL> alter database open;

Database altered.

SQL>

SQL> alter system switch logfile;

System altered.

3. 归档模式下active logfile损坏

场景一:

session 1:

SQL> set line 300
 SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
 ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
 1 1 1 104857600 1 YES INACTIVE 1.2793E+13 04-JUN-14
 2 1 2 104857600 1 NO CURRENT 1.2793E+13 04-JUN-14
 3 1 0 104857600 1 YES UNUSED 0

SQL> alter system switch logfile;

System altered.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
 ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
 1 1 1 104857600 1 YES INACTIVE 1.2793E+13 04-JUN-14
 2 1 2 104857600 1 YES ACTIVE 1.2793E+13 04-JUN-14
 3 1 3 104857600 1 NO CURRENT 1.2794E+13 04-JUN-14

session 2:
 root@kttest1-1 # dd if=/dev/null of=/kttest1-1_data1/emsdev/redo02.dbf bs=512 count=10
 0+0 records in
 0+0 records out

session 1:

SQL> shutdown immediate
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> startup
 ORACLE instance started.

Total System Global Area 3207790592 bytes
 Fixed Size 2119072 bytes
 Variable Size 381586016 bytes
 Database Buffers 2818572288 bytes
 Redo Buffers 5513216 bytes
 Database mounted.
 ORA-00320: cannot read file header from log 2 of thread 1
 ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'


 SQL> alter database clear logfile group 2;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> alter database open;

Database altered.

SQL> alter database add logfile group 2 ('/kttest1-1_data1/emsdev/redo02.dbf') size 100m reuse;

Database altered.

场景二:
 恢复方法与非归档模式下的active redo log恢复相同

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a18f509956a427c366160a3189765dc3.html