有整庫備份的情況rman恢復全庫
說明
在利用RMAN備份了整個資料庫後,我們恢復資料庫到備份的狀態,利用之前的全備恢復,需要以下一系列操作。
資料庫恢復
1. 備份全庫
RMAN> list backup;
using target database control file instead of recovery catalog
RMAN> list backup;
RMAN> backup database;
Starting backup at 04-MAR-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=529 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/oracle/u01/app/oracle/oradata/orcl/system01.dbf input datafile fno=00003 name=/oracle/u01/app/oracle/oradata/orcl/sysaux01.dbf input datafile fno=00005 name=/oracle/u01/app/oracle/oradata/orcl/admin01.dbf input datafile fno=00002 name=/oracle/u01/app/oracle/oradata/orcl/undotbs01.dbf input datafile fno=00004 name=/oracle/u01/app/oracle/oradata/orcl/users01.dbf input datafile fno=00006 name=/oracle/u01/app/oracle/oradata/orcl/users02.dbf channel ORA_DISK_1: starting piece 1 at 04-MAR-13 channel ORA_DISK_1: finished piece 1 at 04-MAR-13 piece handle=/oracle/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_03_04/o1_mf_nnndf_TAG20130304T165311_8m8r7r82_.bkp tag=TAG20130304T165311 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45 Finished backup at 04-MAR-13
Starting Control File and SPFILE Autobackup at 04-MAR-13 piece handle=/oracle/u01/app/oracle/backup/c-1324770912-20130304-0d comment=NONE Finished Control File and SPFILE Autobackup at 04-MAR-13 |
備份過程如果沒有設定備份路徑會自動備份到rman預設路徑,通過show all,也可以檢查引數更改備份路徑
2. 檢查備份
RMAN> list backup;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 140 Full 963.54M DISK 00:00:42 04-MAR-13 BP Key: 144 Status: AVAILABLE Compressed: NO Tag: TAG20130304T165311 Piece Name: /oracle/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_03_04/o1_mf_nnndf_TAG20130304T165311_8m8r7r82_.bkp List of Datafiles in backup set 140 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 5925951 04-MAR-13 /oracle/u01/app/oracle/oradata/orcl/system01.dbf 2 Full 5925951 04-MAR-13 /oracle/u01/app/oracle/oradata/orcl/undotbs01.dbf 3 Full 5925951 04-MAR-13 /oracle/u01/app/oracle/oradata/orcl/sysaux01.dbf 4 Full 5925951 04-MAR-13 /oracle/u01/app/oracle/oradata/orcl/users01.dbf 5 Full 5925951 04-MAR-13 /oracle/u01/app/oracle/oradata/orcl/admin01.dbf 6 Full 5925951 04-MAR-13 /oracle/u01/app/oracle/oradata/orcl/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 141 Full 7.52M DISK 00:00:00 04-MAR-13 BP Key: 145 Status: AVAILABLE Compressed: NO Tag: TAG20130304T165357 Piece Name: /oracle/u01/app/oracle/backup/c-1324770912-20130304-0d Control File Included: Ckp SCN: 5925970 Ckp time: 04-MAR-13 SPFILE Included: Modification time: 04-MAR-13 |
通過檢查,已經備份成功,備份集號為141
3. 停庫
SQL> shutdown abort; ORACLE instance shut down. |
此時不用一致性停庫也行,因為模擬實驗,將要刪除整個資料庫檔案。
4. 刪除原庫
[oracle@dev206 oracle]$ rm -rf /oracle/u01/app/oracle/oradata/orcl/* |
5. 測試啟動
SQL> startup ORA-32004: obsolete and/or deprecated parameter(s) specified ORACLE instance started.
Total System Global Area 1224736768 bytes Fixed Size 2020384 bytes Variable Size 352324576 bytes Database Buffers 855638016 bytes Redo Buffers 14753792 bytes ORA-00205: error in identifying control file, check alert log for more info |
此時資料庫已經不能啟動,在啟動到nomount過程中報205錯誤,找不到控制檔案。
6. 進入RMAN恢復控制檔案
[oracle@dev206 ~]$ rman target / RMAN> restore controlfile from '/oracle/u01/app/oracle/backup/c-1324770912-20130304-0d';
Starting restore at 04-MAR-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=540 devtype=DISK
channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 output filename=/oracle/u01/app/oracle/oradata/orcl/control01.ctl output filename=/oracle/u01/app/oracle/oradata/orcl/control02.ctl output filename=/oracle/u01/app/oracle/oradata/orcl/control03.ctl Finished restore at 04-MAR-13 |
檢驗/oracle/u01/app/oracle/oradata/orcl路徑下已經恢復控制檔案。
7. 此時資料庫可以mount
RMAN> alter database mount;
database mounted released channel: ORA_DISK_1 |
8. 恢復資料檔案
RMAN> restore database;
Starting restore at 04-MAR-13 Starting implicit crosscheck backup at 04-MAR-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=540 devtype=DISK Crosschecked 1 objects Finished implicit crosscheck backup at 04-MAR-13
Starting implicit crosscheck copy at 04-MAR-13 using channel ORA_DISK_1 Crosschecked 4 objects Finished implicit crosscheck copy at 04-MAR-13
searching for all files in the recovery area cataloging files... cataloging done
List of Cataloged Files ======================= File Name: /oracle/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_03_04/o1_mf_ncnnf_TAG20130304T143106_8m8hxc3s_.bkp
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /oracle/u01/app/oracle/oradata/orcl/system01.dbf restoring datafile 00002 to /oracle/u01/app/oracle/oradata/orcl/undotbs01.dbf restoring datafile 00003 to /oracle/u01/app/oracle/oradata/orcl/sysaux01.dbf restoring datafile 00004 to /oracle/u01/app/oracle/oradata/orcl/users01.dbf restoring datafile 00005 to /oracle/u01/app/oracle/oradata/orcl/admin01.dbf restoring datafile 00006 to /oracle/u01/app/oracle/oradata/orcl/users02.dbf channel ORA_DISK_1: reading from backup piece /oracle/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_03_04/o1_mf_nnndf_TAG20130304T165311_8m8r7r82_.bkp channel ORA_DISK_1: restored backup piece 1 piece handle=/oracle/u01/app/oracle/flash_recovery_area/ORCL/backupset/2013_03_04/o1_mf_nnndf_TAG20130304T165311_8m8r7r82_.bkp tag=TAG20130304T165311 channel ORA_DISK_1: restore complete, elapsed time: 00:00:36 Finished restore at 04-MAR-13 |
檢驗/oracle/u01/app/oracle/oradata/orcl路徑下已經恢復資料檔案。
9. 開啟資料庫
RMAN> alter database open resetlogs;
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of alter db command at 03/04/2013 17:05:30 ORA-01152: file 1 was not restored from a sufficiently old backup ORA-01110: data file 1: '/oracle/u01/app/oracle/oradata/orcl/system01.dbf' |
因為我們只是在物理層恢復了資料檔案,還需要在邏輯上恢復資料庫。
10. 恢復資料庫
RMAN> recover database;
Starting recover at 04-MAR-13 using channel ORA_DISK_1
starting media recovery
unable to find archive log archive log thread=1 sequence=3 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 03/04/2013 17:06:34 RMAN-06054: media recovery requesting unknown log: thread 1 seq 3 lowscn 5925 |
報錯是因為找不到到日誌檔案,繼續下一步。
11. 重做日誌檔案開啟資料庫
RMAN> alter database open resetlogs;
database opened |
檢驗/oracle/u01/app/oracle/oradata/orcl路徑下已經恢復了日誌檔案
此時資料庫已經啟動完成。
12. 重啟資料庫
SQL>startup force |
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26252014/viewspace-755277/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN備份恢復整個庫
- rman資料庫全庫備份與恢復資料庫
- RMAN備份恢復——備份到帶庫的效能
- standby全庫rman備份檔案恢復到異機
- RMAN備份恢復——備份到帶庫的效能(二)
- rman 備份 全庫
- 主庫模型調整需要做一個全庫備份,備份與恢復指令碼模型指令碼
- ORACLE DG從庫 Rman備份恢復Oracle
- 全備份情況下,刪除控制檔案及恢復
- Oracle主庫歸檔丟失,備庫日誌有gap,在不重建備庫的情況下,恢復備庫Oracle
- RMAN備份恢復——RAC環境資料庫的備份(zt)資料庫
- RMAN備份恢復--RAC環境資料庫的備份(十)資料庫
- RMAN備份恢復——RAC環境資料庫的備份(一)資料庫
- 利用rman全備恢復刪除的資料庫資料庫
- 【備份恢復】RMAN catalog 恢復目錄資料庫資料庫
- rman 全庫恢復asm資料庫ASM資料庫
- 資料庫在沒有備份的情況下的資料檔案損壞的恢復資料庫
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- Oracle DG從庫 Rman備份恢復測試Oracle
- 非RMAN熱備份資料庫和恢復資料庫
- Oracle資料庫備份與恢復之RMANOracle資料庫
- 【備份恢復】從備份恢復資料庫資料庫
- RMAN全庫備份指令碼指令碼
- 【備份恢復】之RMAN 恢復目錄庫(客戶端備份資訊註冊到目標庫恢復目錄中)客戶端
- REDO檔案丟失的恢復__沒有任何備份的情況
- rman恢復資料庫--用備份的控制檔案資料庫
- Oracle 無備份情況恢復ocr和olrOracle
- 利用RMAN恢復整個資料庫資料庫
- RMAN 全庫備份和 0級備份的區別
- 只存在RMAN備份片的資料庫恢復過程資料庫
- rman 非歸檔模式下停庫備份與恢復模式
- Oracle資料庫備份與恢復之RMAN2Oracle資料庫
- RMAN備份恢復原理
- Oracle塊損壞恢復(有rman備份)Oracle
- Control File中備份資訊被覆蓋情況下的資料庫恢復案例資料庫
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- rman備份恢復-rman入門
- undo表空間檔案丟失恢復(2)--無備份有redo的情況下恢復