从磁带恢复归档出现ORA-19870错误

从磁带中直接恢复归档日志时,出现了这个错误信息。
归档日志前后备份了两次,一次是在备份数据库后做的,另一次是凌晨7点左右进行的,其中第二次备份包含的归档日志比第一次多,最近的归档日志文件备份信息如下:

BS KEY  SIZE       Device TYPE Elapsed TIME Completion TIME    
------- ---------- ----------- ------------ -------------------
37761   3.18G      SBT_TAPE    00:01:22     2011-08-27 03:22:37
        BP KEY: 37761   STATUS: AVAILABLE  Compressed: NO  Tag: TAG20110827T032114
        Handle: al_43199_1_760245675   Media: 
  List OF Archived Logs IN backup SET 37761
  Thrd Seq     Low SCN    Low TIME            NEXT SCN   NEXT TIME
  ---- ------- ---------- ------------------- ---------- ---------
  1    132214  10200825285755 2011-08-27 00:35:39 10200825450980 2011-08-27 00:40:04  
  1    132215  10200825450980 2011-08-27 00:40:04 10200825451525 2011-08-27 00:40:06
  1    132216  10200825451525 2011-08-27 00:40:06 10200826640012 2011-08-27 01:05:42
  1    132217  10200826640012 2011-08-27 01:05:42 10200828085370 2011-08-27 02:08:11
  1    132218  10200828085370 2011-08-27 02:08:11 10200831622590 2011-08-27 03:05:09
  1    132219  10200831622590 2011-08-27 03:05:09 10200831803462 2011-08-27 03:21:02
  1    132220  10200831803462 2011-08-27 03:21:02 10200831803603 2011-08-27 03:21:12
BS KEY  SIZE       Device TYPE Elapsed TIME Completion TIME    
------- ---------- ----------- ------------ -------------------
37763   4.22G      SBT_TAPE    00:06:40     2011-08-27 07:12:26
        BP KEY: 37763   STATUS: AVAILABLE  Compressed: NO  Tag: TAG20110827T070545
        Handle: al_43201_1_760259146   Media: 
  List OF Archived Logs IN backup SET 37763
  Thrd Seq     Low SCN    Low TIME            NEXT SCN   NEXT TIME
  ---- ------- ---------- ------------------- ---------- ---------
  1    132214  10200825285755 2011-08-27 00:35:39 10200825450980 2011-08-27 00:40:04
  1    132215  10200825450980 2011-08-27 00:40:04 10200825451525 2011-08-27 00:40:06
  1    132216  10200825451525 2011-08-27 00:40:06 10200826640012 2011-08-27 01:05:42
  1    132217  10200826640012 2011-08-27 01:05:42 10200828085370 2011-08-27 02:08:11
  1    132218  10200828085370 2011-08-27 02:08:11 10200831622590 2011-08-27 03:05:09
  1    132219  10200831622590 2011-08-27 03:05:09 10200831803462 2011-08-27 03:21:02
  1    132220  10200831803462 2011-08-27 03:21:02 10200831803603 2011-08-27 03:21:12
  1    132221  10200831803603 2011-08-27 03:21:12 10200839298501 2011-08-27 05:59:17
  1    132222  10200839298501 2011-08-27 05:59:17 10200851993798 2011-08-27 07:05:40
  1    132223  10200851993798 2011-08-27 07:05:40 10200851993847 2011-08-27 07:05:44

而且这两个备份并不在同一个磁带中,前面的一份归档备份和全库备份同处于一个磁带中,因此在恢复的过程中,直接将这盘磁带取出,在另一台服务器上进行恢复。
全库的还原没有碰到问题,但是恢复归档日志则碰到了下面的错误:

RMAN> run
2> {
3>         ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
4>         SEND 'NB_ORA_SERV=nbusrv, NB_ORA_CLIENT=ccicdbsrv5';
5>         restore archivelog FROM SEQUENCE 132214  until SEQUENCE 132220;
6>         RELEASE CHANNEL ch00;
7> }
allocated channel: ch00
channel ch00: sid=1630 devtype=SBT_TAPE
channel ch00: Veritas NetBackup FOR Oracle - Release 6.5 (2007072323)
sent command TO channel: ch00
Starting restore at 2011-09-11 21:03:48
channel ch00: starting archive log restore TO DEFAULT destination
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132214
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132215
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132216
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132217
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132218
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132219
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132220
channel ch00: reading FROM backup piece al_43201_1_760259146
ORA-19870: error reading backup piece al_43201_1_760259146
ORA-19507: failed TO retrieve sequential file, handle="al_43201_1_760259146", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received FROM media manager layer, error text:
   Failed TO OPEN backup file FOR restore.
failover TO previous backup
channel ch00: starting archive log restore TO DEFAULT destination
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132214
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132215
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132216
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132217
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132218
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132219
channel ch00: restoring archive log
archive log thread=1 SEQUENCE=132220
channel ch00: reading FROM backup piece al_43199_1_760245675
ORA-19870: error reading backup piece al_43199_1_760245675
ORA-19507: failed TO retrieve sequential file, handle="al_43199_1_760245675", parms=""
ORA-27029: skgfrtrv: sbtrestore returned error
ORA-19511: Error received FROM media manager layer, error text:
   Failed TO process backup file <al_43199_1_760245675>
failover TO previous backup
released channel: ch00
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure OF restore command at 09/11/2011 21:04:30
RMAN-06026: SOME targets NOT found - aborting restore
RMAN-06025: no backup OF log thread 1 seq 132220 lowscn 10200831803462 found TO restore
RMAN-06025: no backup OF log thread 1 seq 132219 lowscn 10200831622590 found TO restore
RMAN-06025: no backup OF log thread 1 seq 132218 lowscn 10200828085370 found TO restore
RMAN-06025: no backup OF log thread 1 seq 132217 lowscn 10200826640012 found TO restore
RMAN-06025: no backup OF log thread 1 seq 132216 lowscn 10200825451525 found TO restore
RMAN-06025: no backup OF log thread 1 seq 132215 lowscn 10200825450980 found TO restore
RMAN-06025: no backup OF log thread 1 seq 132214 lowscn 10200825285755 found TO restore

由于要恢复的归档日志在两个备份集中存在,因此RMAN尝试了两次进行恢复。第一次寻找al_43201_1_760259146文件,由于这个文件不在当前的磁带中,恢复失败是正常的,但是al_43199_1_760245675文件就存放在当前的磁带中,而仍然出现无法获取文件的错误就不正常了。
考虑到恢复环境和备份环境并不一致,备份时使用的带库而当前仅包含一个磁带,且磁带的catalog信息很可能也没有导入,因此对于源数据的查找可能存在问题。
通过CHANGE BACKUP TAG ‘TAG20110827T070545’ UNAVAILABLE的方式,避免恢复过程中去寻找目前并不存在的备份。再次使用RMAN执行同样的恢复操作,这次恢复成功。
恢复应该在和备份等同条件下进行,否则至少应该保证带库的CATALOG数据导入,否则就可能出现这种跨磁带查找文件时出现的错误,而利用RMAN直接在当前的磁带中扫描文件则不受影响。

This entry was posted in ORACLE and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *