Oracle中Active或Current聯機記錄檔丟失後的恢複方法

來源:互聯網
上載者:User

聯機記錄檔狀態為active或current表示該日誌包含的資料修改還未完全同步到資料文 件中,在執行個體恢複時,還需要讀取其中的redo記錄重演,因此如果損壞,資料丟失在所難免 。

1)類比災難

首先查看log的狀態:

SQL> select group#,sequence#,status from v$log;

GROUP#  SEQUENCE# STATUS

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

    2          5 CURRENT

    3          3 INACTIVE

    4          4 INACTIVE

Group#2的狀態為current,我們找出它所對應的磁碟檔案為:

SQL> select group#,member from v$logfile where group#=2;

GROUP# MEMBER

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

    2 J:\INTEL_LOG\O04DMS0\REDO02.O04DMS0

如果資料庫時正常關閉,在關閉之前,會做一次資料檔案同步,因此為了類比current文 件丟失的情況,我們異常關閉資料庫:

SQL> shutdown abort;

然後把Group#2對應 的檔案REDO02.O04DMS0在作業系統層級上刪除。

2)根據錯誤資訊定位問題

啟動數 據庫會出現以下錯誤

SQL> startup

ORACLE instance started.

Total System Global Area  281018368 bytes

Fixed Size                  1296292 bytes

Variable Size             251660380 bytes

Database Buffers           25165824 bytes

Redo Buffers                2895872 bytes

Database mounted.

ORA-00313: open failed for members of log group 2 of thread 1

ORA-00312: online log 2 thread 1: 'J:\INTEL_LOG\O04DMS0\REDO02.O04DMS0'

ORA-27041: unable to open file

OSD-04002: unable to open file

O/S-Error: (OS 2) The system cannot find the file specified.

由於有一組記錄檔丟失, 因此資料庫只能mount,無法open,查看一下丟失的記錄檔是什麼狀態:

SQL> select group#,sequence#,status from v$log where group#=2;

GROUP#  SEQUENCE# STATUS

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

    2          5CURRENT

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.