Backup And Recovery User's Guide-從RMAN開始-恢復表空間
可以在資料庫開啟時在單獨的表空間上使用RESTORE TABLESPACE和RECOVER TABLESPACE命令。
此時,必須使需要恢復的表空間離線,還原和恢復表空間,然後再使表空間聯機。
如果不能還原資料檔案到新的位置,則使用RMAN的SET NEWNAME命令來指定新的檔名。
然後使用SWITCH DATAFILE ALL命令,等價於使用ALTER DATABASE RENAME FILE這個SQL命令來更新控制檔案反映新的檔名。
與使用者管理的介質恢復不同,不能將聯機表空間置於備份模式中。
與使用者管理的工具不同,RMAN不需要額外的日誌或備份模式,因為它知道資料塊的格式。
練習:在資料庫開啟時,恢復單個的表空間
# 1. 對資料庫進行備份 RMAN> backup database;
Starting backup at 12-JUL-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/TestDB12/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/TestDB12/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/TestDB12/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/TestDB12/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/TestDB12/users01.dbf channel ORA_DISK_1: starting piece 1 at 12-JUL-13 channel ORA_DISK_1: finished piece 1 at 12-JUL-13 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_12/o1_mf_nnndf_TAG20130712T054632_8xzn3rgk_.bkp tag=TAG20130712T054632 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 12-JUL-13 channel ORA_DISK_1: finished piece 1 at 12-JUL-13 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_12/o1_mf_ncsnf_TAG20130712T054632_8xzn5jod_.bkp tag=TAG20130712T054632 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 12-JUL-13 # 2. 刪除users表空間中emp表中的所有資料 sys@TESTDB12>delete from scott.emp;
14 rows deleted. # 3. 使表空間離線 RMAN> SQL 'ALTER TABLESPACE users OFFLINE';
sql statement: ALTER TABLESPACE users OFFLINE # 4. 還原和恢復表空間(為資料檔案指定了新的名字) RMAN> RUN 2> { 3> SET NEWNAME FOR DATAFILE '/u01/app/oracle/oradata/TestDB12/users01.dbf' 4> TO '/u01/app/oracle/oradata/TestDB12/users001.dbf'; 5> RESTORE TABLESPACE users; 6> SWITCH DATAFILE ALL; 7> RECOVER TABLESPACE users; 8> }
executing command: SET NEWNAME
Starting restore at 12-JUL-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=20 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 00004 to /u01/app/oracle/oradata/TestDB12/users001.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_12/o1_mf_nnndf_TAG20130712T054632_8xzn3rgk_.bkp channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TESTDB12/backupset/2013_07_12/o1_mf_nnndf_TAG20130712T054632_8xzn3rgk_.bkp tag=TAG20130712T054632 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 12-JUL-13
datafile 4 switched to datafile copy input datafile copy RECID=3 STAMP=820561942 file name=/u01/app/oracle/oradata/TestDB12/users001.dbf
Starting recover at 12-JUL-13 using channel ORA_DISK_1
starting media recovery media recovery complete, elapsed time: 00:00:00
Finished recover at 12-JUL-13
# 4. 使表空間聯機 MAN> sql 'alter tablespace users online';
sql statement: alter tablespace users online
# 5. 檢視錶空間的內容,資料已經被刪除了,說明已經恢了備份之後的操作。 |
可以使用RESTORE DATAFILE和RECOVER DATAFILE命令在資料檔案層次進行恢復。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17013648/viewspace-1081159/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Backup And Recovery User's Guide-執行RMAN表空間時間點恢復(TSPIRT)GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-恢復整個資料庫GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-恢復單個的資料塊GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-指令碼化RMAN操作GUIIDE指令碼
- Backup And Recovery User's Guide-從RMAN開始-概覽RMAN環境GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-還原和恢復資料庫檔案GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-RMAN操作報表-列表顯示備份GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-顯示預設的RMAN配置GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-使用資料恢復指導診斷和修復錯誤GUIIDE資料恢復
- Backup And Recovery User's Guide-執行完全資料庫恢復-執行表空間的完全恢復GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-開始使用RMAN並連線到資料庫GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫-增量備份GUIIDE資料庫
- Backup And Recovery User's Guide-時間點恢復的基本概念GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-RMAN操作報表-資料庫檔案和備份報告GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-維護RMAN備份-cross-checking備份GUIIDEROS
- Backup And Recovery User's Guide-執行資料庫時間點恢復GUIIDE資料庫
- Backup And Recovery User's Guide-恢復的取消(並行介質恢復)GUIIDE並行
- Backup And Recovery User's Guide-從RMAN開始-維護RMAN備份-刪除過期的備份GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-驗證資料庫檔案和備份GUIIDE資料庫
- Backup And Recovery User's Guide-保證的還原點和快速恢復區空間的使用GUIIDE
- Backup And Recovery User's Guide-介質恢復問題解決GUIIDE
- Backup And Recovery User's Guide-執行完全資料庫恢復GUIIDE資料庫
- Backup And Recovery User's Guide-使用RECOVER命令的自動恢復GUIIDE
- Backup And Recovery User's Guide-從RMAN開始-使用閃回資料庫來回退資料庫GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-練習:對資料庫進行增量備份GUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-備份資料庫-典型的備份選項GUIIDE資料庫
- Backup And Recovery User's Guide-使用SET AUTORECOVERY進行自動恢復GUIIDE
- Backup And Recovery User's Guide-恢復資料庫到祖先incarnationGUIIDE資料庫
- Backup And Recovery User's Guide-從RMAN開始-備份處於非歸檔模式的資料庫GUIIDE模式資料庫
- Backup And Recovery User's Guide-RMAN資料修復概念-RMAN介質恢復GUIIDE
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份表空間和資料檔案GUIIDE資料庫
- Backup And Recovery User's Guide-閃回和資料庫時間點恢復場景GUIIDE資料庫
- Backup And Recovery User's Guide-閃回和資料庫時間點恢復的目的GUIIDE資料庫
- Backup And Recovery User's Guide-為完全資料庫恢復做準備GUIIDE資料庫
- Backup And Recovery User's Guide-允許恢復損壞塊:階段4GUIIDE
- Backup And Recovery User's Guide-執行不完全資料庫恢復GUIIDE資料庫
- Backup And Recovery User's Guide-備份和恢復介紹-備份恢復文件RoadmapGUIIDE