rman恢復 使用switch映像副本進行恢復
發起映像副本備份
RMAN> backup as copy database;
Starting backup at 03-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/home/oracle/app/oracle/oradata/sap/system01.dbf
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_system_9kbsnloo_.dbf tag=TAG20140303T213722 RECID=14 STAMP=841268277
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:36
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/home/oracle/app/oracle/oradata/sap/sysaux01.dbf
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_sysaux_9kbsop61_.dbf tag=TAG20140303T213722 RECID=15 STAMP=841268299
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/sap/undotbs01.dbf
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_undotbs1_9kbsphov_.dbf tag=TAG20140303T213722 RECID=16 STAMP=841268312
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/home/oracle/app/oracle/oradata/sap/example01.dbf
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_example_9kbspz1g_.dbf tag=TAG20140303T213722 RECID=17 STAMP=841268322
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/home/oracle/app/oracle/oradata/sap/lztest.dbf
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_lztest_9kbsq6cy_.dbf tag=TAG20140303T213722 RECID=18 STAMP=841268326
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/controlfile/o1_mf_TAG20140303T213722_9kbsq7n2_.ctl tag=TAG20140303T213722 RECID=19 STAMP=841268328
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/home/oracle/app/oracle/oradata/sap/users01.dbf
output file name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_users_9kbsq8qb_.dbf tag=TAG20140303T213722 RECID=20 STAMP=841268328
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 03-MAR-14
channel ORA_DISK_1: finished piece 1 at 03-MAR-14
piece handle=/home/oracle/app/oracle/flash_recovery_area/SAP/backupset/2014_03_03/o1_mf_nnsnf_TAG20140303T213722_9kbsqb2j_.bkp tag=TAG20140303T213722 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 03-MAR-14
刪掉一個檔案
root@sap ~]# rm /home/oracle/app/oracle/oradata/sap/users01.dbf
重啟顯示失敗
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2217912 bytes
Variable Size 503318600 bytes
Database Buffers 318767104 bytes
Redo Buffers 6627328 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/home/oracle/app/oracle/oradata/sap/users01.dbf'
RMAN> switch datafile 4 to copy;
datafile 4 switched to datafile copy "/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_users_9kbsq8qb_.dbf"
starting full resync of recovery catalog
full resync complete
RMAN> recover datafile 4;
Starting recover at 03-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 03-MAR-14
SQL> alter database open;
Database altered.
檢視,目前資料檔案已經switch到的FRA目錄下
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/home/oracle/app/oracle/oradata/sap/system01.dbf
/home/oracle/app/oracle/oradata/sap/sysaux01.dbf
/home/oracle/app/oracle/oradata/sap/undotbs01.dbf
/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_users_9kbsq8qb_.dbf
/home/oracle/app/oracle/oradata/sap/example01.dbf
/home/oracle/app/oracle/oradata/sap/lztest.dbf
6 rows selected.
在原來的位置上再次建立映像副本,切回原來位置。
/home/oracle/app/oracle/oradata/sap/users01.dbf
RMAN> backup as copy datafile 4
2> format '/home/oracle/app/oracle/oradata/sap/users01.dbf';
Starting backup at 03-MAR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_users_9kbsq8qb_.dbf
output file name=/home/oracle/app/oracle/oradata/sap/users01.dbf tag=TAG20140303T220445 RECID=21 STAMP=841269885
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 03-MAR-14
SQL> select df.name,ts#,ts.name
2 from v$datafile df join v$tablespace ts
3 using (ts#);
NAME
--------------------------------------------------------------------------------
TS# NAME
---------- ------------------------------
/home/oracle/app/oracle/oradata/sap/system01.dbf
0 SYSTEM
/home/oracle/app/oracle/oradata/sap/sysaux01.dbf
1 SYSAUX
/home/oracle/app/oracle/oradata/sap/undotbs01.dbf
2 UNDOTBS1
NAME
--------------------------------------------------------------------------------
TS# NAME
---------- ------------------------------
/home/oracle/app/oracle/flash_recovery_area/SAP/datafile/o1_mf_users_9kbsq8qb_.d
bf
4 USERS
/home/oracle/app/oracle/oradata/sap/example01.dbf
6 EXAMPLE
/home/oracle/app/oracle/oradata/sap/lztest.dbf
7 LZTEST
NAME
--------------------------------------------------------------------------------
TS# NAME
---------- ------------------------------
6 rows selected.
SQL> alter tablespace users offline immediate;
Tablespace altered.
RMAN> switch datafile 4 to copy;
datafile 4 switched to datafile copy "/home/oracle/app/oracle/oradata/sap/users01.dbf"
starting full resync of recovery catalog
full resync complete
RMAN> recover datafile 4;
Starting recover at 03-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 03-MAR-14
SQL> alter tablespace users online;
Tablespace altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/home/oracle/app/oracle/oradata/sap/system01.dbf
/home/oracle/app/oracle/oradata/sap/sysaux01.dbf
/home/oracle/app/oracle/oradata/sap/undotbs01.dbf
/home/oracle/app/oracle/oradata/sap/users01.dbf
/home/oracle/app/oracle/oradata/sap/example01.dbf
/home/oracle/app/oracle/oradata/sap/lztest.dbf
6 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27771627/viewspace-1247222/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN恢復 執行重要檔案RMAN恢復
- rman備份恢復命令之switch
- rman恢復時跳過資料檔案,進行恢復
- RMAN恢復 執行不重要檔案的RMAN恢復
- 【備份恢復】丟失所有控制檔案,利用RMAN進行恢復操作
- 查詢RMAN恢復進度
- 使用RMAN來PDB執行完全恢復
- 用rman執行塊恢復
- rman恢復方案和oracle異機恢復Oracle
- rman 恢復機制與恢復測試
- oracle實驗記錄 (恢復-rman恢復)Oracle
- 刪除表空間,有rman全備的恢復(使用dbms_backup_restore來進行恢復)REST
- 使用rman恢復控制檔案
- rman恢復--丟失控制檔案的恢復
- rman備份恢復-rman恢復資料檔案測試
- RMAN恢復實踐
- 資料庫resetlogs後進行rman恢復7資料庫
- 資料庫resetlogs後進行rman恢復6資料庫
- 資料庫resetlogs後進行rman恢復5資料庫
- 資料庫resetlogs後進行rman恢復4資料庫
- 資料庫resetlogs後進行rman恢復3資料庫
- 資料庫resetlogs後進行rman恢復2資料庫
- 資料庫resetlogs後進行rman恢復1資料庫
- 獲取rman備份/恢復執行進度資訊
- 透過RMAN進行資料庫恢復(step by step)資料庫
- 用rman進行恢復資料,簡單步驟!
- 使用RMAN對CDB的root執行完全恢復
- rman恢復資料檔案 恢復表空間
- 【RMAN】RMAN跨版本恢復(上)
- 【RMAN】RMAN跨版本恢復(中)
- 【管理篇備份恢復】rman恢復測試(二) 控制檔案恢復(三)
- 【管理篇備份恢復】rman恢復測試(二) 控制檔案恢復(二)
- 【管理篇備份恢復】rman恢復測試(二) 控制檔案恢復(一)
- rman不使用恢復目錄恢復資料庫示例及問題資料庫
- rman恢復--丟失聯機重做日誌的恢復
- RMAN恢復案例:丟失全部資料檔案恢復
- RMAN備份恢復之控制檔案的恢復(三)
- RMAN備份恢復之控制檔案的恢復(二)