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;