通過reset incarnation實現跨resetlogs的恢復

趙宇發表於2008-04-08
環境:Linux Redhat4 ,Oracle 10g,file system

通過reset database to incarnation 3;回到上一次resetlog所在的incarnation.

目前只有3月24號的備份和所有的歸檔,準備恢復資料庫到3月25號13:20到16:50之間,也就是跨過
incarnation 4的resetlogs.

RMAN> list incarnation;
List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       ORCL     1090770270       PARENT  1          2005-06-30 19:09:40
2       2       ORCL     1090770270       PARENT  446075     2005-07-07 01:58:57
3       3       ORCL     1090770270       CURRENT 1010774    2008-03-25 13:20:57
4       4       ORCL     1090770270       ORPHAN  1012317    2008-03-25 16:52:20



RMAN> run
2> {
3> set until time='2008-03-25 13:40:00';
4> restore database;
5> recover database;
6> alter database open resetlogs;
7> }
executing command: SET until clause
Starting restore at 2008-03-25 18:05:57
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
skipping datafile 1; already restored to file /u01/app/oracle/oradata/orcl/system01.dbf
skipping datafile 2; already restored to file /u01/app/oracle/oradata/orcl/undotbs01.dbf
skipping datafile 3; already restored to file /u01/app/oracle/oradata/orcl/sysaux01.dbf
skipping datafile 4; already restored to file /u01/app/oracle/oradata/orcl/users01.dbf
skipping datafile 5; already restored to file /u01/app/oracle/oradata/orcl/example01.dbf
skipping datafile 6; already restored to file /u01/app/oracle/oradata/orcl/staging01.dbf
restore not done; all files readonly, offline, or already restored
Finished restore at 2008-03-25 18:05:57
Starting recover at 2008-03-25 18:05:57
using channel ORA_DISK_1
starting media recovery
media recovery failed
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/25/2008 18:05:58
ORA-00283: recovery session canceled due to errors
RMAN-11003: failure during parse/execution of SQL statement: alter database recover if needed
start until time 'MAR 25 2008 13:40:00'
ORA-00283: recovery session canceled due to errors
ORA-38727: FLASHBACK DATABASE requires a current control file.

這個datafile已經是24號restore過來的,由於只切換了incarnation,controlfile還是incarnation 4的.


RMAN> restore controlfile from autobackup;
Starting restore at 2008-03-25 18:06:26
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 03/25/2008 18:06:26
RMAN-06496: must use the TO clause when the database is mounted or open
RMAN> list backup of controlfile;

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
4       Full    6.80M      DISK        00:00:00     2008-03-24 17:05:29
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20080324T170529
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_24/o1_mf_s_650221529_3ygvps8h_.bkp
  Control File Included: Ckp SCN: 934330       Ckp time: 2008-03-24 17:05:29
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
5       Full    6.80M      DISK        00:00:00     2008-03-24 17:08:40
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20080324T170840
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_24/o1_mf_s_650221720_3ygvwrll_.bkp
  Control File Included: Ckp SCN: 934500       Ckp time: 2008-03-24 17:08:40
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
6       Full    6.80M      DISK        00:00:00     2008-03-24 17:12:50
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20080324T171250
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_24/o1_mf_s_650221970_3ygw4l9q_.bkp
  Control File Included: Ckp SCN: 934659       Ckp time: 2008-03-24 17:12:50
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
10      Full    6.80M      DISK        00:00:00     2008-03-24 17:18:20
        BP Key: 10   Status: AVAILABLE  Compressed: NO  Tag: TAG20080324T171820
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_24/o1_mf_s_650222300_3ygwgw8v_.bkp
  Control File Included: Ckp SCN: 935569       Ckp time: 2008-03-24 17:18:20
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
12      Full    6.80M      DISK        00:00:00     2008-03-25 13:10:47
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T131047
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650293847_3yk2bqr2_.bkp
  Control File Included: Ckp SCN: 1010240      Ckp time: 2008-03-25 13:10:47
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
13      Full    6.80M      DISK        00:00:01     2008-03-25 13:21:09
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T132107
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650294467_3yk2y4nk_.bkp
  Control File Included: Ckp SCN: 1011647      Ckp time: 2008-03-25 13:21:07
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
14      Full    6.80M      DISK        00:00:00     2008-03-25 14:37:30
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T143730
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650298991_3yk7fbd0_.bkp
  Control File Included: Ckp SCN: 1016697      Ckp time: 2008-03-25 14:36:31
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
15      Full    6.80M      DISK        00:00:00     2008-03-25 15:52:18
        BP Key: 14   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T155218
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650303538_3ykcslo0_.bkp
  Control File Included: Ckp SCN: 1022568      Ckp time: 2008-03-25 15:52:18
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
16      Full    6.80M      DISK        00:00:00     2008-03-25 15:52:20
        BP Key: 15   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T155220
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650303540_3ykcsnfd_.bkp
  Control File Included: Ckp SCN: 1022575      Ckp time: 2008-03-25 15:52:20
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
17      Full    6.80M      DISK        00:00:01     2008-03-25 15:52:22
        BP Key: 16   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T155221
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650303541_3ykcsp61_.bkp
  Control File Included: Ckp SCN: 1022580      Ckp time: 2008-03-25 15:52:21
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
18      Full    6.80M      DISK        00:00:01     2008-03-25 15:57:01
        BP Key: 17   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T155700
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650303820_3ykd2f5k_.bkp
  Control File Included: Ckp SCN: 1022902      Ckp time: 2008-03-25 15:57:00
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
19      Full    6.80M      DISK        00:00:00     2008-03-25 15:57:36
        BP Key: 18   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T155736
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650303856_3ykd3jov_.bkp
  Control File Included: Ckp SCN: 1022929      Ckp time: 2008-03-25 15:57:36
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
20      Full    6.80M      DISK        00:00:01     2008-03-25 16:52:31
        BP Key: 19   Status: AVAILABLE  Compressed: NO  Tag: TAG20080325T165230
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2008_03_25/o1_mf_s_650307150_3ykhbgx3_.bkp
  Control File Included: Ckp SCN: 1012597      Ckp time: 2008-03-25 16:52:30
RMAN>

檢視備份,發現沒有controlfile在incarnation 3時的備份.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/175005/viewspace-231106/,如需轉載,請註明出處,否則將追究法律責任。

相關文章