恢復REDO Log丟失的Oracle資料庫

abstractcyj發表於2013-09-08
假設一個redo group已經丟失,啟動資料庫時,會出現如下的資訊:

   已連線到空閒例程。

SQL> startup
ORACLE 例程已經啟動。

Total System Global Area 1553305600 bytes
Fixed Size                  2176048 bytes
Variable Size            1023413200 bytes
Database Buffers          520093696 bytes
Redo Buffers                7622656 bytes
資料庫裝載完畢。
ORA-03113: 通訊通道的檔案結尾
程式 ID: 4352
會話 ID: 5 序列號: 3


可以通過如下動作恢復:
 C:\Users\chenyj>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期日 9月 8 22:38:07 2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

已連線到空閒例程。

SQL> startup mount
ORACLE 例程已經啟動。

Total System Global Area 1553305600 bytes
Fixed Size                  2176048 bytes
Variable Size            1023413200 bytes
Database Buffers          520093696 bytes
Redo Buffers                7622656 bytes
資料庫裝載完畢。
SQL> select group#, status, archived from v$log;

    GROUP# STATUS                           ARCHIV
---------- -------------------------------- ------
         1 CURRENT                          NO
         3 INACTIVE                         YES
         2 INACTIVE                         YES

SQL> alter database clear logfile group 1;
alter database clear logfile group 1
*
第 1 行出現錯誤:
ORA-00350: 日誌 1 (例項 orcl 的日誌, 執行緒 1) 需要歸檔
ORA-00312: 聯機日誌 1 執行緒 1: 'C:\ORACLE\ORADATA\ORCL\REDO01.LOG'

SQL> alter database clear unarchived logfile group 1;

資料庫已更改。

SQL> alter database open;

資料庫已更改。


請注意其中的unarchived關鍵字.

If you clear your missing log file group, then this will re-create the missing log files;

alter database clear logfile group 1
*
第 1 行出現錯誤:
ORA-00350: 日誌 1 (例項 orcl 的日誌, 執行緒 1) 需要歸檔
ORA-00312: 聯機日誌 1 執行緒 1: 'C:\ORACLE\ORADATA\ORCL\REDO01.LOG'

這個是因為Redo logfile已經被刪除, 因而不能被歸檔。因為log file沒有被歸檔,因而LGWR也不能覆蓋它,即使它已經不再存在。

因而我們需要使用unarchived關鍵字。這樣丟失的redo log就被重建了,然後我們就可以重新啟動資料庫了。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-772365/,如需轉載,請註明出處,否則將追究法律責任。

相關文章