rman 穿越incarnation恢復資料
一 備份資料庫
RMAN> run{
2> allocate channel c1 type disk;
3> backup database include current controlfile format '/home/oracle/rmanbak/chen_%U.trc';
4> }
二 生成測試表
SQL> drop table t_incarnation purge;
SQL> create table t_incarnation as select level as id,'cross successful' as cc from dual connect by level<=3;
SQL> select * from t_incarnation;
ID CC
---------- --------------------------------
1 cross successful
2 cross successful
3 cross successful
三 記錄表資料生成時間
SQL> select to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from dual;
TO_CHAR(SYSDATE,'YYYY-MM-DDHH:MI:SS')
--------------------------------------
2015-07-08 11:14:00
四 模擬誤刪除事故
SQL> drop table t_incarnation purge;
五 RMAN按時間不完全恢復
[oracle@ogg1 ogg1]$ rman target / nocatalog
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 OGG1 4055439112 PARENT 1 15-AUG-09
2 2 OGG1 4055439112 PARENT 945184 06-APR-15
3 3 OGG1 4055439112 PARENT 1590817 07-JUL-15
4 4 OGG1 4055439112 CURRENT 1600502 08-JUL-15
RMAN> shutdown immediate
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 1252663296 bytes
Fixed Size 2212936 bytes
Variable Size 805309368 bytes
Database Buffers 436207616 bytes
Redo Buffers 8933376 bytes
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 OGG1 4055439112 PARENT 1 15-AUG-09
2 2 OGG1 4055439112 PARENT 945184 06-APR-15
3 3 OGG1 4055439112 PARENT 1590817 07-JUL-15
4 4 OGG1 4055439112 CURRENT 1600502 08-JUL-15
將時間恢復到建表之前,模擬恢復故障
RMAN> run{
2> allocate channel t1 type disk;
3> set until time "to_date('2015-07-08 11:12:00','yyyy-mm-dd hh24:mi:ss')";
4> restore database;
5> recover database;
6> }
allocated channel: t1
channel t1: SID=133 device type=DISK
executing command: SET until clause
Starting restore at 08-JUL-15
skipping datafile 4; already restored to file /u01/app/oracle/oradata/ogg1/users01.dbf
channel t1: starting datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
channel t1: restoring datafile 00001 to /u01/app/oracle/oradata/ogg1/system01.dbf
channel t1: restoring datafile 00002 to /u01/app/oracle/oradata/ogg1/sysaux01.dbf
channel t1: restoring datafile 00003 to /u01/app/oracle/oradata/ogg1/undotbs01.dbf
channel t1: restoring datafile 00005 to /u01/app/oracle/oradata/ogg1/example01.dbf
channel t1: restoring datafile 00006 to /u01/app/oracle/oradata/ogg1/chen01.dbf
channel t1: restoring datafile 00007 to /u01/app/oracle/oradata/ogg1/test01.dbf
channel t1: reading from backup piece /home/oracle/rmanbak/chen_0rqbha37_1_1.trc
channel t1: piece handle=/home/oracle/rmanbak/chen_0rqbha37_1_1.trc tag=TAG20150708T110926
channel t1: restored backup piece 1
channel t1: restore complete, elapsed time: 00:00:35
Finished restore at 08-JUL-15
Starting recover at 08-JUL-15
datafile 4 not processed because file is read-only
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 08-JUL-15
released channel: t1
RMAN> alter database open resetlogs;
database opened
SQL> select * from t_incarnation;
select * from t_incarnation
*
ERROR at line 1:
ORA-00942: table or view does not exist
表不存在,說明恢復時間沒有掌握準確
六 進行incarnation穿越,找回資料
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2212936 bytes
Variable Size 805309368 bytes
Database Buffers 436207616 bytes
Redo Buffers 8933376 bytes
Database mounted.
[oracle@ogg1 ~]$ rman target / nocatalog
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jul 8 11:30:56 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: OGG1 (DBID=4055439112, not open)
using target database control file instead of recovery catalog
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 OGG1 4055439112 PARENT 1 15-AUG-09
2 2 OGG1 4055439112 PARENT 945184 06-APR-15
3 3 OGG1 4055439112 PARENT 1590817 07-JUL-15
4 4 OGG1 4055439112 PARENT 1600502 08-JUL-15
5 5 OGG1 4055439112 CURRENT 1600970 08-JUL-15
RMAN> reset database to incarnation 4;
database reset to incarnation 4
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 OGG1 4055439112 PARENT 1 15-AUG-09
2 2 OGG1 4055439112 PARENT 945184 06-APR-15
3 3 OGG1 4055439112 PARENT 1590817 07-JUL-15
4 4 OGG1 4055439112 CURRENT 1600502 08-JUL-15
5 5 OGG1 4055439112 ORPHAN 1600970 08-JUL-15
將資料庫恢復到建表之後,drop之前
RMAN> run{
2> allocate channel t1 type disk;
3> set until time "to_date('2015-07-08 11:14:00','yyyy-mm-dd hh24:mi:ss')";
4> restore database;
5> recover database;
6> }
allocated channel: t1
channel t1: SID=133 device type=DISK
executing command: SET until clause
Starting restore at 08-JUL-15
skipping datafile 4; already restored to file /u01/app/oracle/oradata/ogg1/users01.dbf
channel t1: starting datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
channel t1: restoring datafile 00001 to /u01/app/oracle/oradata/ogg1/system01.dbf
channel t1: restoring datafile 00002 to /u01/app/oracle/oradata/ogg1/sysaux01.dbf
channel t1: restoring datafile 00003 to /u01/app/oracle/oradata/ogg1/undotbs01.dbf
channel t1: restoring datafile 00005 to /u01/app/oracle/oradata/ogg1/example01.dbf
channel t1: restoring datafile 00006 to /u01/app/oracle/oradata/ogg1/chen01.dbf
channel t1: restoring datafile 00007 to /u01/app/oracle/oradata/ogg1/test01.dbf
channel t1: reading from backup piece /home/oracle/rmanbak/chen_0rqbha37_1_1.trc
channel t1: piece handle=/home/oracle/rmanbak/chen_0rqbha37_1_1.trc tag=TAG20150708T110926
channel t1: restored backup piece 1
channel t1: restore complete, elapsed time: 00:00:35
Finished restore at 08-JUL-15
Starting recover at 08-JUL-15
datafile 4 not processed because file is read-only
starting media recovery
archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/OGG1/archivelog/2015_07_08/o1_mf_1_1_bss61qqs_.arc
archived log file name=/u01/app/oracle/flash_recovery_area/OGG1/archivelog/2015_07_08/o1_mf_1_1_bss61qqs_.arc thread=1 sequence=1
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-JUL-15
released channel: t1
RMAN> alter database open resetlogs;
database opened
SQL> select * from t_incarnation;
ID CC
---------- --------------------------------
1 cross successful
2 cross successful
3 cross successful
穿越成功!!!
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-1726518/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle穿越incarnation恢復資料Oracle
- rman通過之前的incarnation恢復資料庫!資料庫
- RMAN恢復資料庫資料庫
- rman 恢復資料塊
- rman恢復資料塊
- RMAN深入解析之--Incarnation應用(不完全恢復)
- rman備份恢復-rman恢復資料檔案測試
- 10可以穿越resetlogs恢復資料庫!資料庫
- rman恢復資料檔案 恢復表空間
- RMAN blockrecover命令恢復資料塊BloC
- rman(4)--資料恢復顧問資料恢復
- oracle之rman恢復資料庫Oracle資料庫
- LianTong rman資料庫恢復資料庫
- RMAN恢復案例:丟失全部資料檔案恢復
- 【RMAN】rman使用NORESTELOGS 方式恢復資料庫REST資料庫
- 【備份恢復】RMAN catalog 恢復目錄資料庫資料庫
- rman恢復時跳過資料檔案,進行恢復
- rman 全庫恢復asm資料庫ASM資料庫
- 利用RMAN恢復整個資料庫資料庫
- RMAN恢復案例:丟失非系統資料檔案恢復
- Backup And Recovery User's Guide-恢復資料庫到祖先incarnationGUIIDE資料庫
- 使用RMAN還原和恢復資料庫資料庫
- 利用rman恢復來複制資料庫資料庫
- rman恢復資料檔案-----塊折斷
- 無歸檔日誌恢復rman資料
- RMAN恢復目錄資料庫的搭建資料庫
- oracle RMAN 非歸檔資料庫恢復Oracle資料庫
- Oracle rman incarnationOracle
- rman不使用恢復目錄恢復資料庫示例及問題資料庫
- RMAN 資料庫修復(restore)與資料庫恢復(recover)介紹資料庫REST
- RMAN恢復 執行重要檔案RMAN恢復
- RMAN一次RMAN將資料庫不完全恢復資料庫
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- RMAN完全恢復丟失的資料檔案
- rman資料庫全庫備份與恢復資料庫
- Oracle Rman 資料庫的不完全恢復Oracle資料庫
- 非RMAN熱備份資料庫和恢復資料庫
- Oracle資料庫備份與恢復之RMANOracle資料庫