SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00392: log 3 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 3 thread 1: '/orabase/bak/oradata/orcl/redo03.log'
官方解释:
CLEARING_CURRENT - Current log is being cleared of a closed thread. The log can stay in this status if there is some failure in the switch such as an I/O error writing the new log header.
CLEARING - Log is being re-created as an empty log after an ALTER DATABASE CLEAR
重做日志文件的集中状态:*(摘)*
1.CURRENT - 当前正在被LGWR使用的group(同时是ACTIVE状态),其中记载数据库中正在进行的更改,删除将导致恢复时数据丢失。
2.ACTIVE - 活动的日志文件状态,日志完成切换或等待检查点事件时都可能出于这种状态,不是CURRENT的日志但是实例恢复时是需要的,此时的日志有可能已经完成了归档,即将变成INACTIVE状态,或者日志文件在等待Checkpoint事件没有完成归档。
3.INACTIVE - 非活动的日志状态,此时的日志实例恢复时不再需要,可能已经归档。
4.UNUSED - 尚未记录change的空白日志组,一般会出现在add logfile, resetlogs打开数据库或者使用了clear logfile命令后。
5.CLEARING - 表示该组重做日志文件正在被ALTER DATABASE CLEAR LOGFILE语句重建中(重建后状态会变成unused)。
6.CLEARING_CURRENT - 表示该组重做日志文件重建时出现错误,出现对日志文件的I/O故障就会出现这种状态。
解决办法:
SQL> select group#,bytes/1024/1024||'M',status from v$log;
GROUP# BYTES/1024/1024||'M' STATUS
---------- ----------------------------------------- ----------------
1 40M CLEARING
3 40M CLEARING_CURRENT
2 40M CLEARING
SQL> alter database clear logfile group 1;
Database altered.
SQL> alter database clear logfile group 2;
Database altered.
SQL> alter database clear logfile group 3;
Database altered.
SQL> alter database open resetlogs;
Database altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- -------------------- ---
3 ONLINE /orabase/bak/oradata NO
/orcl/redo03.log
2 ONLINE /orabase/bak/oradata NO
/orcl/redo02.log
1 ONLINE /orabase/bak/oradata NO
/orcl/redo01.log