1. 現象:
異機資料檔案恢複成功後,執行最後一步開啟資料庫時報錯。例如:
SQL > alter database open resetlogs;
報錯:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u02/Oracle/oradata/mingya/system01.dbf'
2. 原因:
造成這種報錯的原因是因為controlfile裡所記錄的scn與datafile裡的scn不一致,導致資料庫啟動時失敗。
3. 解決
3.1 確定需要恢複的achivelog
將資料庫啟動到mount狀態;
$ rman target / catalog rman/rman@catalog ;串連到RMAN
RMAN> recover database;
運行命令後,RMAN將會報錯,在最後列出需要的archivelog;例如:
RMAN-06025: no backup of log thread 1 seq 3784 lowscn 82847939 found to restore
RMAN-06025: no backup of log thread 1 seq 3783 lowscn 82845664 found to restore
其中的3783、3784是我們需要恢複的archivelog。
3.2 從磁帶庫備份中恢複所需archivelog
RMAN> run {
2>set archivelog destination to '/u03/oracle/archivelog'; 該路徑根據歸檔日誌實際路徑設定
3> allocate channel ch00 type 'SBT_TAPE';
4> send 'NB_ORA_SERV=BAKSERV,NB_ORA_CLIENT=HOSTA';
5> restore archivelog sequence between 3783 and 3784;
6> release channel ch00;
7> }
恢複成功後,在/u03/oracle/archivelog目錄下將看到3783、3784兩個檔案。
3.3 應用archivelog
RMAN> run{
2> allocate channel ch00 type disk;
3> set until sequence 3785 thread 1; 3785是需要恢複的最大號3784+1
4> recover database;
5> release channel ch00;
6> }
3.4 開啟資料庫
RMAN> alter database open resetlogs;
至此,資料庫可以正常開啟。為使其他用戶端能串連本資料庫,最好重新建立監聽listener.ora,其他用戶端重新設定串連檔案tnsnames.ora。
4. 其他問題-ORA-19625錯誤解決
在測試機上恢複操作成功後,正常啟動並執行生產主機用NBU進行備份時,可能出現以下錯誤:
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-03002: failure of backup command at 09/02/2009 02:21:47
ORA-19625: error identifying file /u03/oracle /archivelog/2009_08_31/1_3783_634497921.dbf
==== ended in error on Wed Sep 2 02:21:48 CST 2009 ====
這時需要進行以下操作修正:
登入正常啟動並執行主機:
$ rman target / catalog rman/rman@catalog
RMAN> crosscheck archivelog all;
推薦閱讀:
Oracle基礎教程之通過RMAN複製資料庫
RMAN備份策略制定參考內容
RMAN備份學習筆記
OracleDatabase Backup加密 RMAN加密