Resetlogs与Incarnation
作者 :OoNiceDream【转载时请务必以超链接形式标明文章原始出处和作者信息】
链接:http://www.dbaroad.me/archives/2009/07/resetlogs_incarnation.html
链接:http://www.dbaroad.me/archives/2009/07/resetlogs_incarnation.html
数据不完全恢复后,如果不是在RMAN中以RESETLOGS打开数据库的话,常会遇见这样的报错:
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20003: target database incarnation not found in recovery catalog |
例如:
RMAN> list incarnation; 数据库 Incarnations 列表 DB 关键字 Inc 关键字 DB 名 DB ID CUR 重置 SCN 重置时间 ------- ------- -------- ---------------- --- ---------- ---------- 1 2 SKY 2987191772 NO 1248567 19-7月 -08 1 37 SKY 2987191772 YES 1270013 16-10月-08 RMAN> list backup of database; RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of list command at 07/21/2009 14:01:22 RMAN-06004: ORACLE error from recovery catalog database: RMAN-20003: target database incarnation not found in recovery catalog |
或者我们再进行数据库备份:
RMAN> run{ 2> allocate channel c1 type disk; 3> allocate channel c2 type disk; 4> allocate channel c3 type disk; 5> sql 'alter system archive log current'; 6> backup incremental level 0 database tag 'DB_FULL_BACKUP' format 'd:\oracle_bak\full_%d_%T_%s_%p' 7> include current controlfile; 8> backup archivelog all format 'AL_%d_%t_%s_%p' 9> delete input; 10> release channel c1; 11> release channel c2; 12> release channel c3; 13> } 14> 分配的通道: c1 通道 c1: sid=12 devtype=DISK 分配的通道: c2 通道 c2: sid=11 devtype=DISK 分配的通道: c3 通道 c3: sid=9 devtype=DISK sql 语句: alter system archive log current 启动 backup 于 21-7月 -09 释放的通道: c1 释放的通道: c3 释放的通道: c2 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 07/21/2009 17:31:03 RMAN-06004: ORACLE error from recovery catalog database: RMAN-20003: target database incarnation not found in recovery catalog 恢复管理器完成。 |
报错是因为RESETLOGS后,RESETLOGS_CHANGE#、RESETLOGS_TIME已经与catalog库中记录的incarnation信息不一致了。当前数据库中的incarnation信息可以查询v$database_incarnation视图:
SQL>select * from v$database_incarnation; RESETLOGS_CHANGE# RESETLOGS_TIME PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TIM ----------------- ------------------- ----------------------- ------------------- 1248567 2008-07-19 15:25:36 1248399 2008-07-19 15:21:20 1270013 2008-10-16 23:09:56 1248567 2008-07-19 15:25:36 1442433 2009-06-29 20:45:02 1270013 2008-10-16 23:09:56 1443480 2009-07-21 15:51:40 1442433 2009-06-29 20:45:02 1444034 2009-07-21 16:27:55 1443480 2009-07-21 15:51:40 1444726 2009-07-21 17:29:36 1444034 2009-07-21 16:27:55 |
我们可以采用reset database重新注册一个新的incarnation,避免报错:
RMAN> reset database; 在恢复目录中注册的数据库的新实体化 正在启动全部恢复目录的 resync 完成全部 resync RMAN> list incarnation; 数据库 Incarnations 列表 DB 关键字 Inc 关键字 DB 名 DB ID CUR 重置 SCN 重置时间 ------- ------- -------- ---------------- --- ---------- ---------- 1 2 SKY 2987191772 NO 1248567 19-7月 -08 1 37 SKY 2987191772 NO 1270013 16-10月-08 1 697 SKY 2987191772 YES 1442433 29-6月 -09 |
另外,恢复完成后,如果我们是在RMAN中以RESETLOGS打开数据库的话,会自动注册新的Incarnation:
RMAN> list incarnation; 数据库 Incarnations 列表 DB 关键字 Inc 关键字 DB 名 DB ID CUR 重置 SCN 重置时间 ------- ------- -------- ---------------- --- ---------- ---------- 1 2 SKY 2987191772 NO 1248567 19-7月 -08 1 37 SKY 2987191772 NO 1270013 16-10月-08 1 697 SKY 2987191772 YES 1442433 29-6月 -09 RMAN> alter database open resetlogs; 数据库已打开 在恢复目录中注册的数据库的新实体化 正在启动全部恢复目录的 resync 完成全部 resync RMAN> list incarnation; 数据库 Incarnations 列表 DB 关键字 Inc 关键字 DB 名 DB ID CUR 重置 SCN 重置时间 ------- ------- -------- ---------------- --- ---------- ---------- 1 2 SKY 2987191772 NO 1248567 19-7月 -08 1 37 SKY 2987191772 NO 1270013 16-10月-08 1 697 SKY 2987191772 NO 1442433 29-6月 -09 1 891 SKY 2987191772 YES 1443480 21-7月 -09 |
— The End —
关键字: 备份恢复


站内搜索