1. 程式人生 > >OPEN RESETLOGS ,報ORA-00392 ORA-00312 in Oracle12c

OPEN RESETLOGS ,報ORA-00392 ORA-00312 in Oracle12c

ORA-00392 ;ORA-0031

【現象】

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-00392: log 4 of thread 1 is being cleared, operation not allowed

ORA-00312: online log 4 thread 1: '/mnt/data/PBF/db/proddata/redo04a.log'

ORA-00312: online log 4 thread 1: '/mnt/data/PBF/db/proddata/redo04b.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 1000M

CLEARING

2 1000M

CLEARING

5 1000M

CLEARING

GROUP# BYTES/1024/1024||'M'

---------- -----------------------------------------

STATUS

------------------------------------------------

4 1000M

CLEARING_CURRENT

3 1000M

CLEARING

SQL>

SQL>

SQL>

SQL> alter database clear logfile group 1;

alter database clear logfile group 2;

alter database clear logfile group 3;

alter database clear logfile group 4;

alter database clear logfile group 5;

Database altered.

SQL>

Database altered.

SQL>

Database altered.

SQL>

Database altered.

SQL>

Database altered.

SQL> col group# form 99

SQL> col bytes form 99999999999

SQL> col status form a20

SQL> select group#,bytes/1024/1024||'M',status from v$log;

GROUP# BYTES/1024/1024||'M' STATUS

------ ----------------------------------------- --------------------

1 1000M UNUSED

2 1000M UNUSED

5 1000M UNUSED

4 1000M CURRENT

3 1000M UNUSED


alter database open resetlogs;

OK!

OPEN RESETLOGS ,報ORA-00392 ORA-00312 in Oracle12c