欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

shutdownabort模式丢失redo,使用隐含参数启库

程序员文章站 2024-02-14 13:55:58
...

shutdown abort模式 丢失redo log 无法open数据库 通过告警报错ORA-00354: corrupt redo log block header 从该错误可以看出当前日志的redo block的header出现问题,导致oracle无法读取redo进行恢复。通过以下检查发现数据库文件头都一致,没有需要恢复的文件

shutdown abort模式
丢失redo log
无法open数据库
通过告警报错ORA-00354: corrupt redo log block header 从该错误可以看出当前日志的redo block的header出现问题,导致oracle无法读取redo进行恢复。通过以下检查发现数据库文件头都一致,没有需要恢复的文件,但是由于数据库是非正常关闭,last_change scn没有被写入,数据库判断需要恢复,则读取相应的redo log group 3,但是此时该文件已经损坏。
SYS@orcl11g>alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

SYS@orcl11g>recover database;
ORA-00283: recovery session canceled due to errors
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/opt/oracle/oradata/orcl11g/redo03.log'
ORA-27046: file size is not a multiple of logical block size
Additional information: 1

SYS@orcl11g>recover database until cancel;
ORA-00279: change 5168496 generated at 10/29/2014 23:48:23 needed for thread 1
ORA-00289: suggestion : /opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_29/o1_mf_1_159_%u_.arc
ORA-00280: change 5168496 for thread 1 is in sequence #159

Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00308: cannot open archived log '/opt/oracle/flash_recovery_area/ORCL11G/archivelog/2014_10_29/o1_mf_1_159_%u_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 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: '/opt/oracle/oradata/orcl11g/system01.dbf'
加入以下隐含参数:
SYS@orcl11g>show parameter _allow
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
_allow_error_simulation              boolean                TRUE
_allow_resetlogs_corruption          boolean                TRUE
这时候发现数据库时可以打开的
SYS@orcl11g>
SYS@orcl11g>
SYS@orcl11g>alter database open resetlogs;

Database altered.

SYS@orcl11g>

发现日志文件已经被重建:
SYS@orcl11g>select group#,status from v$log;
    GROUP# STATUS
---------- ------------------------------------------------------------
         1 CURRENT
         2 UNUSED
         3 UNUSED

SYS@orcl11g>alter system switch logfile;

System altered.

SYS@orcl11g>/

System altered.

SYS@orcl11g>/

System altered.

SYS@orcl11g>select group#,status from v$log;
    GROUP# STATUS
---------- ------------------------------------------------------------
         1 CURRENT
         2 INACTIVE
         3 ACTIVE