数据库ORA-01196故障-归档日志丢失恢复详解
问题:
由于机房停电,其中一DG备库无法open,启动时报错
启动数据库时报下面的错误
SQL>alterdatabaseopen; alterdatabaseopen *
第1行出现错误:
ORA-10458:standbydatabaserequiresrecovery
ORA-01196:文件1由于介质恢复会话失败而不一致
ORA-01110:数据文件1:'+DATA/htdb7/datafile/system.313.884996245'
查看归档日志应用情况,发现一部分日志没应用
SQL>SelectName,Sequence#,applied,completion_timeFromv$archived_logOrderBySequence#Desc; Name,Sequence#appliedcompletion_time +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328776.705.939567729328776YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328775.713.939567727328775YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328774.777.939567727328774YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328773.771.939567725328773YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328772.422.939567721328772YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328771.482.939567721328771YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328770.755.939567721328770YESNO2017/3/2515:02 +FRA/htdb7/archivelog/2017_03_24/thread_1_seq_328757.1255.939481573328757YESNO2017/3/2415:06 +FRA/htdb7/archivelog/2017_03_24/thread_1_seq_328756.795.939480431328756YESYES2017/3/2414:47 +FRA/htdb7/archivelog/2017_03_24/thread_1_seq_328755.543.939479395328755YESYES2017/3/2414:29 +FRA/htdb7/archivelog/2017_03_24/thread_1_seq_328754.390.939478683328754YESYES2017/3/2414:18 +FRA/htdb7/archivelog/2017_03_24/thread_1_seq_328753.1845.939477943328753YESYES2017/3/2414:05 --再和其它备库或主库的归档日志做对比,很明显发现这个备库没有同步并应用主库的日志 --此备库: [oracle@hotel07~]$asmcmd-p ASMCMD[+fra/htdb7/ARCHIVELOG]>cd2017_03_24/ ASMCMD[+fra/htdb7/ARCHIVELOG/2017_03_24]>ls ...... thread_1_seq_328754.390.939478683 thread_1_seq_328755.543.939479395 thread_1_seq_328756.795.939480431 thread_1_seq_328757.1255.939481573 --其它正常的备库 [oracle@hotel05~]$asmcmd-p ASMCMD[+fra/htdb5/ARCHIVELOG/2017_03_24]>ls thread_1_seq_328754.4124.939478683 thread_1_seq_328755.349.939479395 thread_1_seq_328756.852.939480431 thread_1_seq_328757.1420.939481575 thread_1_seq_328758.3356.939510647 thread_1_seq_328759.4592.939510649 thread_1_seq_328760.3205.939510647 thread_1_seq_328761.5308.939510649 thread_1_seq_328762.5227.939510653 .....
解决办法:
需要从其它备库或主库上面把此备库缺失的归档日志手动传输过来,然后再进行open操作
步骤如下:
1.在另一正常的备库用rman备份缺失的归档日志
[oracle@hotel05~]$rmantarget/ RMAN>copyarchivelog'+fra/htdb5/ARCHIVELOG/2017_03_24/thread_1_seq_328759.4592.939510649'to'/home/oracle/arcbak/thread_1_seq_328759.4592.939510649';
启动backup于25-3月-17
使用通道ORA_DISK_1
通道ORA_DISK_1:正在开始复制归档日志
输入归档日志线程=1序列=328759RECID=328754STAMP=939510652
输出文件名=/home/oracle/arcbak/thread_1_seq_328759.4592.939510649RECID=328794STAMP=939571923
通道ORA_DISK_1:归档日志复制完成,经过时间:00:00:03
完成backup于25-3月-17
......
.备份完成后,把归档传输到丢失归档的备库
[oracle@hotel05arcbak]$scp*hotel07:/home/oracle/arcbak/
3.然后在此备库上进行恢复操作
--编制归档文件目录
[oracle@hotel07~]$rmantarget/
恢复管理器:Release11.2.0.2.0-Productionon星期六3月2515:42:112017
Copyright(c)1982,2009,Oracleand/oritsaffiliates. Allrightsreserved.
已连接到目标数据库:HTDB4(DBID=1083719948,未打开)
RMAN>catalogstartwith'/home/oracle/arcbak';
搜索与样式/home/oracle/arcbak匹配的所有文件
数据库未知文件的列表 ===================================== 文件名:/home/oracle/arcbak/thread_1_seq_328763.4773.939510653 文件名:/home/oracle/arcbak/thread_1_seq_328767.2765.939511033 文件名:/home/oracle/arcbak/thread_1_seq_328766.5854.939511023 文件名:/home/oracle/arcbak/thread_1_seq_328759.4592.939510649 文件名:/home/oracle/arcbak/thread_1_seq_328758.3356.939510647 文件名:/home/oracle/arcbak/thread_1_seq_328760.3205.939510647 文件名:/home/oracle/arcbak/thread_1_seq_328762.5227.939510653 文件名:/home/oracle/arcbak/thread_1_seq_328761.5308.939510649 文件名:/home/oracle/arcbak/thread_1_seq_328757.1420.939481575 文件名:/home/oracle/arcbak/thread_1_seq_328764.5801.939510653 文件名:/home/oracle/arcbak/thread_1_seq_328765.3298.939510657
是否确实要将上述文件列入目录(输入YES或NO)?y
正在编制文件目录...
目录编制完毕
已列入目录的文件的列表 ======================= 文件名:/home/oracle/arcbak/thread_1_seq_328763.4773.939510653 文件名:/home/oracle/arcbak/thread_1_seq_328767.2765.939511033 文件名:/home/oracle/arcbak/thread_1_seq_328766.5854.939511023 文件名:/home/oracle/arcbak/thread_1_seq_328759.4592.939510649 文件名:/home/oracle/arcbak/thread_1_seq_328758.3356.939510647 文件名:/home/oracle/arcbak/thread_1_seq_328760.3205.939510647 文件名:/home/oracle/arcbak/thread_1_seq_328762.5227.939510653 文件名:/home/oracle/arcbak/thread_1_seq_328761.5308.939510649 文件名:/home/oracle/arcbak/thread_1_seq_328757.1420.939481575 文件名:/home/oracle/arcbak/thread_1_seq_328764.5801.939510653 文件名:/home/oracle/arcbak/thread_1_seq_328765.3298.939510657
--恢复归档日志 RMAN>copyarchivelog'/home/oracle/arcbak/thread_1_seq_328757.1420.939481575'to'+fra';
启动backup于25-3月-17
使用通道ORA_DISK_1
通道ORA_DISK_1:正在开始复制归档日志
输入归档日志线程=1序列=328760RECID=149368STAMP=939573701
输出文件名=+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328760.474.939573739RECID=149375STAMP=939573738
通道ORA_DISK_1:归档日志复制完成,经过时间:00:00:01
完成backup于25-3月-17
......
4.最后就可以open数据库了
SQL>alterdatabaseopen; SQL>selectopen_modefromv$database; OPEN_MODE -------------------- READONLYWITHAPPLY --查看日志,归档日志正常进行应用 alterdatabaseopen DataGuardBrokerinitializing... DataGuardBrokerinitializationcomplete Beginningstandbycrashrecovery. SerialMediaRecoverystarted ManagedStandbyRecoverystartingRealTimeApply MediaRecoveryLog+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328757.499.939573737 MediaRecoveryLog/home/oracle/arcbak/thread_1_seq_328758.3356.939510647 SatMar2516:43:572017 IncompleteRecoveryapplieduntilchange91347484119time03/24/201715:06:26 Completedstandbycrashrecovery. SatMar2516:43:582017 SMON:enablingcacherecovery Dictionarycheckbeginning Dictionarycheckcomplete DatabaseCharactersetisZHS16GBK NoResourceManagerplanactive replication_dependency_trackingturnedoff(noasyncmultimasterreplicationfound) Physicalstandbydatabaseopenedforreadonlyaccess. Completed:alterdatabaseopen SatMar2516:44:012017 ALTERDATABASERECOVERMANAGEDSTANDBYDATABASETHROUGHALLSWITCHOVERDISCONNECTUSINGCURRENTLOGFILE AttempttostartbackgroundManagedStandbyRecoveryprocess(htdb7) SatMar2516:44:012017 MRP0startedwithpid=47,OSid=9619 MRP0:BackgroundManagedStandbyRecoveryprocessstarted(htdb7) startedlogmergerprocess SatMar2516:44:062017 ManagedStandbyRecoverystartingRealTimeApply ParallelMediaRecoverystartedwith16slaves Waitingforallnon-currentORLstobearchived... Allnon-currentORLshavebeenarchived. MediaRecoveryLog/home/oracle/arcbak/thread_1_seq_328758.3356.939510647 MediaRecoveryLog+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328759.1574.939573739 Completed:ALTERDATABASERECOVERMANAGEDSTANDBYDATABASETHROUGHALLSWITCHOVERDISCONNECTUSINGCURRENTLOGFILE MediaRecoveryLog+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328760.922.939573741 MediaRecoveryLog+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328761.695.939573743 MediaRecoveryLog+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328762.1769.939573745 MediaRecoveryLog+FRA/htdb7/archivelog/2017_03_25/thread_1_seq_328763.1422.939573745
在由于停电和网络原因,造成主备数据不同步,日志丢失的情况,主要学会使用rman工具把归档文件在fs和asm之间传输。在数据库恢复时会经常用到。
另外,如果数据库开启了闪回功能,也可以使用闪回数据库的某个时点进行恢复。可以参考另一篇博文:oracle数据库ORA-01196错误解决办法分享。
希望对大家有所帮助,感谢阅读。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。