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

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 database open resetlogs;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

三.非归档下current状态的redo恢复


session 1:
 SQL> create table test as select * from dba_extents;

Table created.

SQL> select * from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
 ---------- ---------- ---------- ---------- ---------- --- ----------------
 FIRST_CHANGE# FIRST_TIM
 ------------- ---------
 1 1 1 104857600 1 NO CURRENT
 1.2792E+13 04-JUN-14

2 1 0 104857600 1 YES UNUSED
 0

3 1 0 104857600 1 YES UNUSED

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

session 1:

SQL> delete from test where rownum <100000;

45074 rows deleted.
 SQL> commit;

Commit complete.

SQL> shutdown immediate
 ORA-03113: end-of-file on communication channel
 Process ID: 14382
 Session ID: 83 Serial number: 3

SQL> startup
 ORA-24324: service handle not initialized
 ORA-01041: internal error. hostdef extension doesn't exist
 SQL> conn /as sysdba
 Connected to an idle instance.
 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-00316: log 1 of thread 1, type 0 in header is not log file
 ORA-00312: online log 1 thread 1: '/kttest1-1_data1/emsdev/redo01.dbf'

SQL> recover database until cancel;
 ORA-00279: change 12792226263763 generated at 06/04/2014 10:45:34 needed for
 thread 1
 ORA-00289: suggestion : /kttest1-1_data1/emsdev/arch/1_1_849350732.arch
 ORA-00280: change 12792226263763 for thread 1 is in sequence #1


 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
 auto
 ORA-00308: cannot open archived log
 '/kttest1-1_data1/emsdev/arch/1_1_849350732.arch'
 ORA-27037: unable to obtain file status
 SVR4 Error: 2: No such file or directory
 Additional information: 3


 ORA-00308: cannot open archived log
 '/kttest1-1_data1/emsdev/arch/1_1_849350732.arch'
 ORA-27037: unable to obtain file status
 SVR4 Error: 2: No such file or directory
 Additional information: 3


 ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
 ORA-01194: file 1 needs more recovery to be consistent
 ORA-01110: data file 1: '/kttest1-1_data1/emsdev/system01.dbf'


 SQL> alter database open resetlogs;
 alter database open resetlogs
 *
 ERROR at line 1:
 ORA-01194: file 1 needs more recovery to be consistent
 ORA-01110: data file 1: '/kttest1-1_data1/emsdev/system01.dbf'


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


 SQL> alter database open;
 alter database open
 *
 ERROR at line 1:
 ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


 SQL> alter database open resetlogs;

Database altered.


如果无法直接open resetlogs打开的话,要检查一下alert.log报错:

Thu Jul 18 16:38:42 2013
 SMON: enabling cache recovery
 Thu Jul 18 16:38:43 2013
 Errors in file /oracle/admin/orcl/udump/orcl_ora_11149.trc:
 ORA-00600: internal error code, arguments: [2662], [0], [4099916], [0], [4100136], [4194313], [], []
 Thu Jul 18 16:38:43 2013
 Error 600 happened during db open, shutting down database
 USER: terminating instance due to error 600
 Instance terminated by USER, pid = 11149
 ORA-1092 signalled during: alter database open resetlogs...

如出现ora-00600 [2662]报错,需要推进scn。推进方法如下:

ORA-600 [2662] [a] [b] [c] [d] [e]

Arg [a] Current SCN WRAP
 Arg [b] Current SCN BASE
 Arg [c] dependent SCN WRAP
 Arg [d] dependent SCN BASE
 Arg [e] Where present this is the DBA where the dependent SCN came from.

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

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