[Oracle] restore all redo logs physically deleted when the database is running
Lab environment:
OEL5.6 Oracle11.2.0.1
Lab started:
Database running status, delete all logs:
[Oracle @ itaa test] $ ls
Control01.ctl redo01.log sysaux01.dbf undotbs01.dbf
Data_ol01.dbf redo02.log system01.dbf users01.dbf
Example01.dbf redo03.log temp01.dbf
[Oracle @ itaa test] $ rm-rf *. log
Switch the log group in the database:
SYS @ TEST> alter system switch logfile;
System altered.
SYS @ TEST>/
System altered.
SYS @ TEST>/
Alter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SYS @ TEST> insert into t select * from dba_objects;
72504 rows created.
SYS @ TEST>/
72504 rows created.
SYS @ TEST>/
72504 rows created.
SYS @ TEST>/
72504 rows created.
SYS @ TEST>/
72504 rows created.
SYS @ TEST>/
In this case, the hung database is in place and all services are suspended. The alert Log reports the following error:
Mon Jul 13 17:03:28 2015
Errors in file/u01/app/oracle/diag/rdbms/test/TEST/trace/TEST_m000_23367.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/TEST/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file/u01/app/oracle/diag/rdbms/test/TEST/trace/TEST_m000_23367.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/TEST/redo02.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file/u01/app/oracle/diag/rdbms/test/TEST/trace/TEST_m000_23367.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/TEST/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Temporarily disable the listener to prevent the new service from occupying the full session. At this time, the new connection can be normally connected to the database.
Do not stop the database at this time, because the database cannot be shut down normally. Once the database is down, data will inevitably be lost.
In this case, use sysdba to connect to the database and directly clear the log group to restore normal operation of the database.
SYS @ TEST> alter database clear unarchived logfile group 1;
Database altered.
SYS @ TEST> alter database clear unarchived logfile group 2;
Database altered.
SYS @ TEST> alter database clear unarchived logfile group 3;
Database altered.
The database returns to normal.