Oracle RMAN 不完全恢復(只有資料檔案備份,丟失歸檔日誌備份)

feelpurple發表於2015-12-21
有一個測試資料庫環境,資料庫損壞只能啟動到 MOUNT 狀態,只有資料檔案備份,丟失了歸檔,嘗試進行恢復。

啟動資料庫到 MOUNT 狀態,登入備份檔案資訊到 RMAN

RMAN> catalog start with 'E:\app\Administrator\flash_recovery_area\fire\BACKUPSET\2015_12_15';

RMAN> catalog start with 'E:\app\Administrator\flash_recovery_area\fire\BACKUPSET\2015_11_25';

檢視資料檔案的備份資訊,找到備份資料庫時的 SCN ,Ckp SCN 

RMAN> list backup of database;

使用目標資料庫控制檔案替代恢復目錄

備份集列表
===================

BS 關鍵字  型別 LV 大小       裝置型別 經過時間 完成時間
------- ---- -- ---------- ----------- ------------ ----------
7       Full    1.30G      DISK        00:00:00     25-11月-15
        BP 關鍵字: 7   狀態: AVAILABLE  已壓縮: NO  標記: TAG20151125T101109
段名:E:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\FIRE\BACKUPSET\2015_11_25\O1_MF_NNNDF_TAG20151125T101109_C5B65Y85_.BKP
  備份集 7 中的資料檔案列表
  檔案 LV 型別 Ckp SCN    Ckp 時間   名稱
  ---- -- ---- ---------- ---------- ----
  1       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\SYSTEM01.DBF
  2       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\SYSAUX01.DBF
  3       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\UNDOTBS01.DBF
  4       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\USERS01.DBF
  5       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\EXAMPLE01.DBF
  6       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\FIRE\DATAFILE\O1_MF_FIRE_BTGS1SFX_.DBF
  7       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\FIRE\DATAFILE\O2_MF_FIRE_BTGS1SFX_.DBF
  8       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\TEST01.DBF
  9       Full 8037053724 25-11月-15 E:\APP\ADMINISTRATOR\ORADATA\FIRE\FLAME01.DBF

進行資料檔案恢復和介質恢復,由於丟失歸檔日誌,僅恢復到備份資料庫檔案的那一時間點的 SCN

RMAN> RUN

  SET UNTIL SCN 8037053724;
  RESTORE DATABASE;
  RECOVER DATABASE;
}

executing command: SET until clause


Starting restore at 2015-12-21 18:02:59
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK


channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /ORADATA/oradata/flame/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /ORADATA/oradata/flame/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /ORADATA/oradata/flame/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /ORADATA/oradata/flame/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /ORADATA/oradata/flame/test01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /ORADATA/oradata/flame/test02.dbf
channel ORA_DISK_1: reading from backup piece /u02/app/oracle/fast_recovery_area/FLAME/backupset/2015_12_15/o1_mf_nnnd0_TAG20151215T163117_c6zmyokr_.bkp
channel ORA_DISK_1: piece handle=/u02/app/oracle/fast_recovery_area/FLAME/backupset/2015_12_15/o1_mf_nnnd0_TAG20151215T163117_c6zmyokr_.bkp tag=TAG20151215T163117
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 2015-12-21 18:03:02


Starting recover at 2015-12-21 18:03:02
using channel ORA_DISK_1


starting media recovery
media recovery complete, elapsed time: 00:00:01


Finished recover at 2015-12-21 18:03:03

開啟資料庫

SQL> alter database open resetlogs;

Database altered.

檢視資料庫 RESETLOG 的記錄

SQL> select * from V$DATABASE_INCARNATION;

INCARNATION# RESETLOGS_CHANGE# RESETLOGS_TIME   PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TIM STATUS  RESETLOGS_ID PRIOR_INCARNATION# FLASHBACK_DATABASE_ALLOWED
------------ ----------------- ------------------- ----------------------- ------------------- ------- ------------ ------------------ --------------------------
  1     1 2011-09-17 09:46:04 0       PARENT  762083164     0 NO
  2 995548 2015-12-01 10:01:29 1 2011-09-17 09:46:04 PARENT  897300089     1 NO
  3       1118444 2015-12-01 16:47:50    995548 2015-12-01 10:01:29 PARENT  897324470     2 NO
  4       2663257 2015-12-21 18:03:47   1118444 2015-12-01 16:47:50 CURRENT  899057027     3 NO

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

相關文章