首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 數據庫知識 >  >> Oracle 資料庫 >> Oracle 教學

RMAN-06023 錯誤解決:Incarnation 不匹配導致備份不可見

     編輯:Oracle 教學

RMAN-06023: no backup of datafile found to restore 根因與修復

現象:RESTORE DATABASE VALIDATE 或 RESTORE DATABASE 報 RMAN-06023,但 LIST BACKUP OF DATAFILE n 顯示備份集存在且 AVAILABLE,文件也在磁盤上。根因:中間執行過不完全恢復並 OPEN RESETLOGS,導致 INCARNATION 遞增,RMAN 默認只查找當前化身的備份。

一、錯誤現場

RMAN-03002: failure of restore command
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 1 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore

二、驗證備份確實存在

RMAN> LIST BACKUP OF DATAFILE 1;
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
46739   Full    1.75G      DISK        00:16:07     05-MAR-15
  BP Key: 50263  Status: AVAILABLE  Compressed: YES  Tag: TAG20150305T010709
  Piece Name: /u03/flash_recovery_area/backup/backupsets/ora_df873514789_s46810_s1
  List of Datafiles in backup set 46739
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    Full 17572554495 05-MAR-15 /u01/app/oracle/oradata/epps/system01.dbf

# 文件系統確認
$ ls /u03/flash_recovery_area/backup/backupsets/ora_df873508030_s46807_s1
存在

三、定位 Incarnation 不匹配

RMAN> LIST INCARNATION;
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- ------- ---------- ----------
1       1       EPPS     2179993557       PARENT  1          30-JUN-05
2       2       EPPS     2179993557       PARENT  446075     19-JUL-09
3       3       EPPS     2179993557       CURRENT 16926695161 23-JAN-15

當前化身為 3,但備份屬於化身 2 (Reset SCN 446075 之前)。

四、解決方案:重置目標化身

RMAN> RESET DATABASE TO INCARNATION 2;
database reset to incarnation 2

重置後再次執行 RESTORE DATABASE 即可識別備份並正常恢復。

五、知識點總結

  • RESETLOGS 會創建新化身,RMAN 默認綁定當前化身;
  • 跨化身恢復必須顯式 RESET DATABASE TO INCARNATION n;
  • 生產環境執行 OPEN RESETLOGS 前務必全備份,並記錄化身變更歷史;
  • 參考官方文檔 Point-in-Time Recovery and Database Incarnations: Concepts (7.6.2)。
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved