实验环境:
OEL5.6 Oracle11.2.0.1
实验开始:
数据库运行状态,删除所有日志:
[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
在数据库中切换日志组:
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>/
此时数据库hung住,所有业务都暂停,alert日志报错如下:
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
暂时关闭监听,防止新业务占满session,此时新连接可以正常连入数据库。
这时候不要停库,因为数据库已经无法正常关闭,一旦数据库down掉,必然会丢失数据。
此时使用sysdba连入数据库,直接clear日志组,数据库即可恢复正常运行。
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.
数据库运行恢复正常。