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

Total System Global Area 3207790592 bytes
 Fixed Size 2119072 bytes
 Variable Size 381586016 bytes
 Database Buffers 2818572288 bytes
 Redo Buffers 5513216 bytes
 Database mounted.


 SQL> alter session set events '10015 trace name adjust_scn level 11914';

Session altered.

SQL> select substr(checkpoint_change#,1,14) as df_scn from v$datafile;

DF_SCN
 --------------------------------------------------------
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122

DF_SCN
 --------------------------------------------------------
 12792226298122
 12792226298122

13 rows selected.

SQL> select substr(checkpoint_change#,1,14) as dfh_scn from v$datafile;

DFH_SCN
 --------------------------------------------------------
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122
 12792226298122

DFH_SCN
 --------------------------------------------------------
 12792226298122
 12792226298122

13 rows selected.

SQL> alter database open;

Database altered.

场景二:

+++++Session 1
 SQL> conn /as sysdba
 Connected.
 SQL> set lines 200
 SQL> col member for a60
 SQL> select * from v$Log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
 ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
 1 1 7 10485760 1 NO CURRENT 1073767933 22-JUL-13
 2 1 5 10485760 1 YES INACTIVE 1073742213 21-JUL-13
 3 1 6 52428800 1 YES INACTIVE 1073742215 21-JUL-13
 SQL> select * from v$logfile;

GROUP# STATUS TYPE MEMBER IS_
 ---------- ------- ------- ------------------------------------------------------------ ---
 2 ONLINE /home/ora10g/oradata/roger/redo02.log NO
 3 ONLINE /home/ora10g/oradata/roger/redo03.log NO
 1 ONLINE /home/ora10g/oradata/roger/redo01.log NO

SQL>
 SQL> alter system switch logfile;

System altered.

++++Session 2

[ora10g@killdb ~]$ dd if=/dev/null of=/home/ora10g/oradata/roger/redo02.log 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 167772160 bytes
 Fixed Size 1272600 bytes
 Variable Size 96470248 bytes
 Database Buffers 67108864 bytes
 Redo Buffers 2920448 bytes
 Database mounted.
 ORA-00327: log 2 of thread 1, physical size less than needed
 ORA-00312: online log 2 thread 1: '/home/ora10g/oradata/roger/redo02.log'


 SQL> select * from v$Log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
 ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
 1 1 7 10485760 1 YES INACTIVE 1073767933 22-JUL-13
 3 1 6 52428800 1 YES INACTIVE 1073742215 21-JUL-13
 2 1 8 10485760 1 NO CURRENT 1073770766 22-JUL-13

SQL> recover database until cancel;
 Media recovery complete.


 SQL> alter database open resetlogs;
 alter database open resetlogs
 *
 ERROR at line 1:
 ORA-00327: log 2 of thread 1, physical size less than needed
 ORA-00312: online log 2 thread 1: '/home/ora10g/oradata/roger/redo02.log'

在pfile文件中加入两个参数:
*._allow_resetlogs_corruption=true
 *._allow_error_simulation=true

SQL> startup mount pfile='/tmp/pfile.ora';
 ORACLE instance started.

Total System Global Area 167772160 bytes
 Fixed Size 1272600 bytes
 Variable Size 96470248 bytes
 Database Buffers 67108864 bytes
 Redo Buffers 2920448 bytes
 Database mounted.

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

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