测试环境:数据库已经备份,联机重做日志有4组.
第一种情况:丢失的是非当前组:
当前组是1,删除第4组,关闭数据库再打开数据库后报错:
ORA-03113: end-of-file on communicationchannel
Process ID: 3737
Session ID: 1 Serial number: 5
查看告警日志文件可以看出是丢失了redo4.log
Errors in file/u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_lgwr_7652.trc:
ORA-00313: open failed for members of loggroup 4 of thread 1
ORA-00312: online log 4 thread 1:'/u01/app/oracle/oradata/orcl/redo4.log'
ORA-27037: unable to obtain file status
使用如下命令可以重建日志:
startup mount;
alter database clear logfile group 4;
alter database open;--可以正常打开数据库。
第二种情况:丢失的是当前组:
把日志切换到第4组,删除第4组,关闭数据库再执行打开操作。
shutdown abort;
startup;
会直接报错:
ORA-00313: open failed for members of loggroup 4 of thread 1
ORA-00312: online log 4 thread 1:'/u01/app/oracle/oradata/orcl/redo4.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
alter database clear logfile group 4;
也会报错:
ERROR at line 1:
ORA-01624: log 4 needed for crash recoveryof instance orcl (thread 1)
ORA-00312: online log 4 thread 1:'/u01/app/oracle/oradata/orcl/redo4.log'
执行:
recover database until cancel;
alter database open resetlogs;--可以正常打开数据库
小结:
数据库处于关闭状态时,非当前组联机重做日志文件损坏后,可以使用alter database clear logfile group group_number重建联机重做日志文件;
数据库处于关闭状态时,当前组联机重做日志文件损坏后,使用不完全恢复,并用resetlogs打开数据库。