1

搭建dg备库recover database报错ora-利来国际app

杨卓 2021-11-11
327

客户环境linux oracle 11.2.0.4 两节点rac主库,2节点备库;需要对这个客户的数据库使用dg切换进行迁移;
第一轮搭建adg完成后,fail over dg备库 变成测试库给开发应用人员进行测试;
第二轮正式切换之前,搭建重建adg环境, restore database正常,recover database报错

thu oct 28 21:35:11 2021
warning: recovery target destination is in a sibling branch of the controlfile checkpoint. 
recovery will only recover changes to datafiles. 
datafile 1 (ckpscn 20575410237) is orphaned on incarnation#=2 
mrp0: detected orphaned datafiles! recovery will possibly be retried after flashback... 
errors in file /u01/app/oracle/diag/rdbms/oxxx/oxxxx/trace/oxxxx1\_pr00\_5100.trc: 
ora-19909: datafile 1 belongs to an orphan incarnation 
ora-01110: data file 1: ' data/oxxx/datafile/system.265.1087143661' 
managed standby recovery not using real time apply 
recovery slave pr00 previously exited with exception 19909
 thu oct 28 21:35:32 2021 mrp0: background media recovery process shutdown (oxxx1)

2.1 检索相关文档

检索mos有没有相关的文章,找到了一篇几乎类似的!
ora-19906 and ora-19909 at standby site (doc id 1509932.1)

datafile 1 (ckpscn 7502822792898) is orphaned on incarnation#=1 
mrp0: background media recovery terminated with error 19909 
thu nov 22 14:45:00 met 2012 
errors in file < directory >/sgsdgb/admin/bdump/sgsdgb\_mrp0\_20506.trc: 
ora-19909: datafile 1 belongs to an orphan incarnation \[5\] 
ora-01110: data file 1: '< directory >/sgsdgb/data02/system01.dbf' 
thu nov 22 14:45:00 met 2012 
errors in file < directory >/sgsdgb/admin/bdump/sgsdgb\_mrp0\_20506.trc: 
ora-19909: datafile 1 belongs to an orphan incarnation 
ora-01110: data file 1: '< directory >/sgsdgb/data02/system01.dbf'

2.2 检查问题是否匹配

遇到有mos差不多的文档故障处理,啥也别说了,看看是不是匹配这个问题!
redo apply at standby site suddenly failed as shown in the alert.log:
cause
this occurs because the standby database, for various reasons, is opened with resetlogs and information on that resides in the fra. rman will implicitly catalog the fra thus causing information on this “test” incarnation to be inserted into the mounted standby controlfile. therefore information on a new incarnation exists.
报错的场景是说dg recover的时候报错,控制文件"化生"(翻译过来不一定准确incarnation )的问题;
场景往往发生在resetlogs后,产生新的版本的化生,但是rman的 fra自动记录了化生并且将这个化生写入了新的控制文件当中,导致你的dg控制文件存在多个不同scn演进化生的版本;
那么这种情况和我们本次遇到的问题非常的匹配,因为这个新环境dg之前做过一次resetlogs,只要操作一次resetlogs,那么控制文件就会产生一次新的化生(incarnation);
由于我们没有百分百的清理干净,导致oracle rman fra自动将上一次的resetlogs后的化生写入到了控制文件当中,恢复的时候化生版本不对!
最终导致报错!接下来就是进入db查询对比了!

2.3 查询对比

this is the primary database's incarnation: 
rman> list incarnation of database; 
using target database control file instead of recovery catalog 
db key inc key db name db id status reset scn reset time 
------- ------- -------- ---------------- --- ---------- ---------- 
1 1 sgsopa 791150137 current 121289826 09-oct-09 
this is the standby database's incarnation: 
rman> list incarnation of database; 
using target database control file instead of recovery catalog 
db key inc key db name db id status reset scn reset time 
------- ------- -------- ---------------- --- ---------- ---------- 
1 1 sgsopa 791150137 parent 121289826 09-oct-09 
2 2 sgsopa 791150137 current 7502821558550 22-nov-12 
in standby, execute: 
rman> reset database to incarnation 1;

实际操作与mos一致,只是实际环境inc2的时间是上一次resetlogs open第一次搭建dg fail over的时间点!
执行上述操作,recover database;不在报错!
问题到这里就算是解决问题了,进入下一环节,问题学习。

参考文章
https://www.cnblogs.com/askscuti/p/10939593.html 
https://www.cnblogs.com/cqubityj/p/3492569.html

3.1 oracle incarnation是什么?


其实一张图就能解释问题,如果正常情况数据库一直正常运行,那么就只有一个化生,scn一直往一个方向走;
但是在某些场景下,db使用了resetlogs 不完成的恢复时,那么就会产生一个新的化生,因为你的scn方向以及和完全恢复的方向不同了。
如何查询当前数据库的化生
sql> select incarnation#,resetlogs_change#,resetlogs_time,status from v$database_incarnation;

3.2 如何避免出现这个问题呢?

那么如何避免可能出现的控制文件化生导致恢复的干扰的情况呢?mos有方法二,还是上面的同一篇文章。

option #2:
clear the fra information associated with the resetlogs executed against the standby.
1) remove archivelog files and/or controlfile autobackups which were generated by the 
standby when it was activated (opened with resetlogs). 
leave only the archivelog files received from the primary.
2) consider refreshing standby controlfile from primary to remove unnecessary
 incarnation information from standby controlfile's v$database_incarnation.
3)  start manual recovery, applying the next archivelog from the primary
 site to confirm that recovery will now continue
4)  restart automatic recovery at the standby site

1.将上一次resetlogs库open之后产生的archive log ,log进行删除清理;
2.将上一次resetlogs库open之后产生的控制文件自动备份的文件进行清理;
3.使用主库最新的控制文件对dg库的控制文件进行覆盖;

4.再次进行recover之后,开启mrp进程自动恢复。
前三步骤才是重点!

「喜欢文章,快来给作者赞赏墨值吧」
【利来手机国际的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:[email protected]进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论