Oracle資料庫聯機日誌檔案丟失處理方法(2)

jss001發表於2009-02-12
方法二:用cancel模式恢復資料庫

 前面的出錯提示,步驟都一樣,唯獨恢復的方法不一樣SQL>; startup

ORACLE instance started.

Total System Global Area 353862792 bytes

Fixed Size 730248 bytes

Variable Size 285212672 bytes

Database Buffers 67108864 bytes

Redo Buffers 811008 bytes Database mounted.

ORA- 00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: '/T3/ORACLE/oradata/ORA9/redo01.log'看看丟失了哪些redo

SQL> host ls /T3/ORACLE/oradarta/ORA9/redo* /T3/ORACLE/oradarta/ORA9/redo*: No such file or directory看來redo都丟了直接recover

SQL>; recover database until cancel;Media recovery complete.這個時候redo還沒有生成

SQL> host ls /T3/ORACLE/oradata/ORA9/redo* /T3/ORACLE/oradata/ORA9/redo*: No such file or directory啟動資料庫

SQL> alter database open ;alter database open * ERROR at line 1:ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL>; alter database open resetlogs;

Database altered.(注意,這裡必須用resetlogs,否則會錯誤的SQL> alter database open noresetlogs;

alter database open noresetlogs * ERROR at line 1:

ORA- 00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: '/T3/ORACLE/oradata/ORA9/redo01.log'

SQL>Resetlogs其實就是根據控制檔案讓系統自動重新生成redo,如果noresetlog的話,就不會重新生成redo,缺少了檔案,db自然無法啟動)

SQL>; host ls /T3/ORACLE/oradata/ORA9/redo* /T3/ORACLE/oradata/ORA9/redo01.log /T3/ORACLE/oradata/ORA9/redo02.log /T3/ORACLE/oradata/ORA9/redo03.log SQL>;檢驗SQL>; select * from test.test;

TEL

----------

1 2 3 4 SQL>;資料一點兒都沒有丟失

結論:如果資料庫是正常關閉的,用recover database until cancel可以輕鬆恢復或者說重新建立所有的redo,不再區分是否是當前日誌,而且由於正常關閉,不會丟失任何資料,唯一可能丟失的情況就是如果日誌還沒有歸檔這種恢復方法 由於要resetlogs,所以在恢復完成後,日誌清零,以前的備份不再起作用,所以建議立即備份SQL>; archive log list;Database log mode Archive Mode Automatic archival Enabled Archive destination /T3/ORACLE/arch Oldest online log sequence 0 Next log sequence to archive 1 Current log sequence 1 SQL>;
[@more@]

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

相關文章