在恢复数据库的时候,报错:
RMAN> recover database;
Starting recover at 07-NOV-14
using channel ORA_DISK_1
starting media recovery
archive log thread 2 sequence 13 is already on disk as file /home/oracle/arch/2_13_858567385.arc
archive log thread 2 sequence 14 is already on disk as file /home/oracle/arch/2_14_858567385.arc
archive log thread 2 sequence 15 is already on disk as file /home/oracle/arch/2_15_858567385.arc
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/07/2014 07:26:19
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 17 lowscn 1101318 found to restore
RMAN-06025: no backup of log thread 1 seq 16 lowscn 1098429 found to restore
<span style="font-family:Microsoft YaHei;font-size:14px;"></span><pre class="html" name="code">
--查询对应的归档日志:
SQL> select name,sequence#,first_change#
2 from v$archived_log
3 where first_change# in (1101318,1098429);
NAME SEQUENCE# FIRST_CHANGE#
-------------------------------------------------- ---------- -------------
/home/oracle/arch/1_16_858567385.arc 16 1098429
/home/oracle/arch/1_17_858567385.arc 17 1101318
--查看该归档日志是否存在
oracle@rac2 arch]$ cd /home/oracle/arch
[oracle@rac2 arch]$ ls -ltr
-rw-r----- 1 oracle oinstall 621056 Nov 7 07:25 1_16_858567385.arc
-rw-r----- 1 oracle oinstall 11264 Nov 7 07:26 1_17_858567385.arc
-rw-r----- 1 oracle oinstall 1729536 Nov 7 07:36 2_16_858567385.arc
看到,这两个归档日志是物理存在的,这就奇怪了。
--查看下这两个归档日志的状态
SQL> l
1 select name,status
2 from v$archived_log
3 *where first_change# in (1101318,1098429);
NAME S
-------------------------------------------------- -
/home/oracle/arch/1_16_858567385.arc X
/home/oracle/arch/1_17_858567385.arc X
日志状态竟然为X,但这个归档日志明明存在呀
<span style="font-family:Microsoft YaHei;font-size:14px;"></span>
归档日志状态为X的原因:
控制文件里记录了这个归档日志的位置,当这个归档日志被移走了(即使你后来又将其移动过来了)或者删除了,该归档日志就会被标记为EXPIRED。
我出错是因为,起初rac2归档路径下没有rac1的归档日志,因此,rac1的归档日志都被标记为X(即EXPIRED)。虽然我后来通过NFS,将rac1的归档日志共享给了rac2,但此时该归档日志还是会被标记为EXPIRED。
解决办法:
当你确定该归档日志物理上存在后,crosscheck archivelog all
现在再查看状态,变成A了。
NAME S
-------------------------------------------------- -
/home/oracle/arch/1_16_858567385.arc A
/home/oracle/arch/1_17_858567385.arc A
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff"></span>
<span style="font-family:Microsoft YaHei;font-size:14px;"></span>
然后恢复数据库,也不报错了:
RMAN> recover database;
Starting recover at 07-NOV-14
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 16 is already on disk as file /home/oracle/arch/1_16_858567385.arc
archive log thread 1 sequence 17 is already on disk as file /home/oracle/arch/1_17_858567385.arc
archive log thread 2 sequence 13 is already on disk as file /home/oracle/arch/2_13_858567385.arc
archive log thread 2 sequence 14 is already on disk as file /home/oracle/arch/2_14_858567385.arc
archive log thread 2 sequence 15 is already on disk as file /home/oracle/arch/2_15_858567385.arc
archive log filename=/home/oracle/arch/2_13_858567385.arc thread=2 sequence=13
archive log filename=/home/oracle/arch/1_16_858567385.arc thread=1 sequence=16
archive log filename=/home/oracle/arch/2_14_858567385.arc thread=2 sequence=14
media recovery complete, elapsed time: 00:00:05
Finished recover at 07-NOV-14
<span style="font-family:Arial;BACKGROUND-COLOR: #ffffff"></span>
<span style="font-family:Microsoft YaHei;font-size:14px;"></span>
总结:
造成这个错误的原因:
1:该归档日志物理上被删除了;
2:该归档日志物理上存在,但被标记为了expired状态;