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

GROUP# STATUS TYPE
 ---------- ------- -------
 MEMBER IS_
 ---------------------------------------------------------------------- ---
 3 ONLINE
 /kttest1-1_data1/emsdev/redo03.dbf NO

1 ONLINE
 /kttest1-1_data1/emsdev/redo01.dbf NO

2 ONLINE
 /kttest1-1_data1/emsdev/redo02.dbf NO

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> select * from v$log;

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

2 1 25 314572800 1 NO ACTIVE
 1.2792E+13 04-JUN-14

3 1 24 104857600 1 NO INACTIVE
 1.2792E+13 03-JUN-14

SQL>SQL> shutdown abort
 ORACLE instance shut down.
 SQL> select * from v$log;
 select * from v$log
 *
 ERROR at line 1:
 ORA-01034: ORACLE not available
 Process ID: 3544
 Session ID: 83 Serial number: 3


 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-00320: cannot read file header from log 2 of thread 1
 ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'
 ORA-27069: attempt to do I/O beyond the range of the file
 Additional information: 1
 Additional information: 1


 SQL> alter database clear logfile group 2;
 alter database clear logfile group 2
 *
 ERROR at line 1:
 ORA-01624: log 2 needed for crash recovery of instance emsdev1 (thread 1)
 ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'


 SQL> alter database drop logfile group 2;
 alter database drop logfile group 2
 *
 ERROR at line 1:
 ORA-01624: log 2 needed for crash recovery of instance emsdev1 (thread 1)
 ORA-00312: online log 2 thread 1: '/kttest1-1_data1/emsdev/redo02.dbf'

SQL> recover database until cancel;
 ORA-00279: change 12792226234738 generated at 06/04/2014 09:35:35 needed for
 thread 1
 ORA-00289: suggestion : /kttest1-1_data1/emsdev/arch/1_32_848646308.arch
 ORA-00280: change 12792226234738 for thread 1 is in sequence #32


 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
 auto
 ORA-00308: cannot open archived log
 '/kttest1-1_data1/emsdev/arch/1_32_848646308.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_32_848646308.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'

32没有归档,不能这样恢复

SQL> select * from v$log;

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

3 1 34 104857600 1 NO CURRENT
 1.2792E+13 04-JUN-14

2 1 33 104857600 1 NO ACTIVE
 1.2792E+13 04-JUN-14


 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'

SQL> show parameter pfile

NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 spfile string
 SQL> shutdown immediate
 ORA-01109: database not open


 Database dismounted.
 ORACLE instance shut down.
 SQL>

在pfile文件中加入两个参数:
*._allow_resetlogs_corruption=true
 *._allow_error_simulation=true ----从oracle 10g开始,引入的另外一个参数。

SQL> conn /as sysdba
 Connected to an idle instance.
 SQL> startup mount
 ORACLE instance started.

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

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