rman异常案例一: 归档日志被人移动到其他目录,导致数据库恢复异常

 rman对数据库做了正常的备份,所有数据都全在,然后在对数据库做恢复的时候报错,发现归档日志被人移动到了其他目录,导致数据库恢复异常。

这种情况应该挺常见的,归档日志被移走的原因很多,最常见的就是因为生产库空间不足,需要移动到其他服务器,或者归档日志所在的磁盘是速度极快的磁盘(为了追求归档速度),然而保存归档的磁盘不需要那么好,为了追求性价比,等等,原因很多... 解决办法也很简单,看我的操作过程就明白了。


再总结一下,就是有rman全备份,有所有归档日志,第二次全备份来没有来得及做,系统出了问题,需要恢复数据库。




1、归档日志都在归档目录下,正常地做恢复的过程

suse11sp2:/oracle/oraarch # ls
1_88_821442260.dbf  1_90_821442260.dbf  1_92_821442260.dbf
1_89_821442260.dbf  1_91_821442260.dbf




suse11sp2:/oracle/rman> rman target / nocatalog;


Recovery Manager: Release 11.2.0.3.0 - Production on Sat Aug 17 11:43:52 2013


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: EBAI (DBID=2006597394, not open)
using target database control file instead of recovery catalog


RMAN> restore database;


Starting restore at 17-AUG-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=610 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=1217 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=1824 device type=DISK


channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /oracle/oradata/ebai/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oracle/oradata/ebai/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/rman/data_0tohh219_1_1_20130817
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /oracle/oradata/ebai/system01.dbf
channel ORA_DISK_2: restoring datafile 00006 to /oracle/oradata/aa.dbf
channel ORA_DISK_2: reading from backup piece /oracle/rman/data_0rohh219_1_1_20130817
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00002 to /oracle/oradata/ebai/sysaux01.dbf
channel ORA_DISK_3: restoring datafile 00004 to /oracle/oradata/ebai/users01.dbf
channel ORA_DISK_3: reading from backup piece /oracle/rman/data_0sohh219_1_1_20130817
channel ORA_DISK_1: piece handle=/oracle/rman/data_0tohh219_1_1_20130817 tag=TOTALDB_HOT_BKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_2: piece handle=/oracle/rman/data_0rohh219_1_1_20130817 tag=TOTALDB_HOT_BKUP
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:15
channel ORA_DISK_3: piece handle=/oracle/rman/data_0sohh219_1_1_20130817 tag=TOTALDB_HOT_BKUP
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:15
Finished restore at 17-AUG-13


RMAN>


RMAN>


RMAN> recover database;


Starting recover at 17-AUG-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3


starting media recovery


archived log for thread 1 with sequence 88 is already on disk as file /oracle/oraarch/1_88_821442260.dbf
archived log for thread 1 with sequence 89 is already on disk as file /oracle/oraarch/1_89_821442260.dbf
archived log for thread 1 with sequence 90 is already on disk as file /oracle/oraarch/1_90_821442260.dbf
archived log for thread 1 with sequence 91 is already on disk as file /oracle/oraarch/1_91_821442260.dbf
archived log for thread 1 with sequence 92 is already on disk as file /oracle/oraarch/1_92_821442260.dbf
archived log file name=/oracle/oraarch/1_88_821442260.dbf thread=1 sequence=88
archived log file name=/oracle/oraarch/1_89_821442260.dbf thread=1 sequence=89
archived log file name=/oracle/oraarch/1_90_821442260.dbf thread=1 sequence=90
media recovery complete, elapsed time: 00:00:04
Finished recover at 17-AUG-13




2、模拟归档日志被移动到其他位置,做恢复的过程,遭遇报错



suse11sp2:/oracle/oraarch # mkdir test
suse11sp2:/oracle/oraarch # mv *.dbf   test
suse11sp2:/oracle/oraarch/test # ls
1_88_821442260.dbf  1_90_821442260.dbf  1_92_821442260.dbf
1_89_821442260.dbf  1_91_821442260.dbf


 




RMAN> restore database;


Starting restore at 17-AUG-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3


channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /oracle/oradata/ebai/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /oracle/oradata/ebai/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/rman/data_0tohh219_1_1_20130817
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /oracle/oradata/ebai/system01.dbf
channel ORA_DISK_2: restoring datafile 00006 to /oracle/oradata/aa.dbf
channel ORA_DISK_2: reading from backup piece /oracle/rman/data_0rohh219_1_1_20130817
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00002 to /oracle/oradata/ebai/sysaux01.dbf
channel ORA_DISK_3: restoring datafile 00004 to /oracle/oradata/ebai/users01.dbf
channel ORA_DISK_3: reading from backup piece /oracle/rman/data_0sohh219_1_1_20130817
channel ORA_DISK_1: piece handle=/oracle/rman/data_0tohh219_1_1_20130817 tag=TOTALDB_HOT_BKUP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_2: piece handle=/oracle/rman/data_0rohh219_1_1_20130817 tag=TOTALDB_HOT_BKUP
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:07
channel ORA_DISK_3: piece handle=/oracle/rman/data_0sohh219_1_1_20130817 tag=TOTALDB_HOT_BKUP
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:07
Finished restore at 17-AUG-13


RMAN> recover database;


Starting recover at 17-AUG-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3


starting media recovery


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/17/2013 11:46:47
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 92 and starting SCN of 2419529 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 91 and starting SCN of 2418760 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 90 and starting SCN of 2415900 found to restore


因为rman无法找到需要用于恢复的归档日志,恢复过程中断且报错。




我尝试移动其中三个时间靠前的归档日志回到原归档目录,依然报错,说明如果我们不指定,oracle不会按量恢复,归档日志需要完全才可以。
RMAN> recover database;


Starting recover at 17-AUG-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3


starting media recovery


archived log for thread 1 with sequence 88 is already on disk as file /oracle/oraarch/1_88_821442260.dbf
archived log for thread 1 with sequence 89 is already on disk as file /oracle/oraarch/1_89_821442260.dbf
archived log for thread 1 with sequence 90 is already on disk as file /oracle/oraarch/1_90_821442260.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/17/2013 12:04:50
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 92 and starting SCN of 2419529 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 91 and starting SCN of 2418760 found to restore


RMAN>




RMAN> alter database open;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/17/2013 12:06:57
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/oracle/oradata/ebai/system01.dbf'










3、把所有归档日志从test目录再移动回到归档目录原位置,恢复过程恢复正常





RMAN> recover database;


Starting recover at 17-AUG-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3


starting media recovery


archived log for thread 1 with sequence 90 is already on disk as file /oracle/oraarch/1_90_821442260.dbf
archived log for thread 1 with sequence 91 is already on disk as file /oracle/oraarch/1_91_821442260.dbf
archived log for thread 1 with sequence 92 is already on disk as file /oracle/oraarch/1_92_821442260.dbf
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=88
channel ORA_DISK_1: reading from backup piece /oracle/rman/arch_0vohh21q_1_1_20130817
channel ORA_DISK_2: starting archived log restore to default destination
channel ORA_DISK_2: restoring archived log
archived log thread=1 sequence=89
channel ORA_DISK_2: reading from backup piece /oracle/rman/arch_10ohh21q_1_1_20130817
channel ORA_DISK_1: piece handle=/oracle/rman/arch_0vohh21q_1_1_20130817 tag=TAG20130817T110842
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/oracle/oraarch/1_88_821442260.dbf thread=1 sequence=88
channel ORA_DISK_2: piece handle=/oracle/rman/arch_10ohh21q_1_1_20130817 tag=TAG20130817T110842
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
archived log file name=/oracle/oraarch/1_89_821442260.dbf thread=1 sequence=89
archived log file name=/oracle/oraarch/1_90_821442260.dbf thread=1 sequence=90
media recovery complete, elapsed time: 00:00:03
Finished recover at 17-AUG-13


RMAN> alter database open;


database opened



___________________________________________________________________________________

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Author:   laven54 (lurou)

Email:    laven54@163.com

Blog:      http://blog.csdn.net/laven54

QQ群: 164734649  可以到群里来提问,Oracle相关的问题我都很感兴趣




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值