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恢復實踐
- rman 增量備份恢復
- Oracle RMAN恢復測試Oracle
- RMAN備份恢復技巧
- RMAN備份恢復典型案例——異機恢復未知DBID
- RMAN恢復之RMAN-06555處理
- Oracle RMAN 表空間恢復Oracle
- RMAN備份異機恢復
- 12 使用RMAN備份和恢復檔案
- RMAN備份恢復效能優化優化
- 在rman恢復中incarnation的概念
- RMAN備份與恢復測試
- NBU恢復Oracle通道完成後RMAN沒有進度Oracle
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- Oracle 備份恢復篇之RMAN catalogOracle
- ORACLE DG從庫 Rman備份恢復Oracle
- rman備份異機恢復(原創)
- dg丟失歸檔,使用rman增量備份恢復
- Mysql 誤刪資料進行恢復MySql
- Oracle 12C新特性-RMAN恢復表Oracle
- RMAN備份恢復典型案例——ORA-00245
- DM7使用DMRAMN對多次故障恢復後使用不同資料庫的歸檔進行恢復資料庫
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- 12C PDB使用RMAN的4種完全恢復場景
- 如何進行RAID0資料恢復AI資料恢復
- 在Linux中,如何進行資料恢復?Linux資料恢復
- 如何進行SQL Server容災恢復WISQLServer
- [20190718]12c rman新特性 表恢復.txt
- 備份恢復Lesson 04.Using the RMAN Recovery Catalog
- 怎樣用恢復驅動器來恢復win10 使用恢復驅動器恢復win10系統的步驟Win10
- (Les16 執行資料庫恢復)-表空間恢復資料庫
- 【RMAN】Oracle12c以後rman 備份恢復命令參考Oracle
- 【RMAN】在多租戶環境下的RMAN備份及恢復
- 資料恢復:AMDU資料抽取恢復資料恢復
- postgreSQL 恢復至故障點 精準恢復SQL
- 使用 “恢復模式” 或 “DFU 模式” 來更新和恢復 iOS 韌體模式iOS
- 在Linux中,如何進行系統故障恢復?Linux