RMAN备份异常

备份日志:

[[email protected] data]$ cat 20130226_220001-inc2.log

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Feb 26 22:00:01 2013

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

connected to target database: DBTEST (DBID=1193549399)

RMAN> run{
2>    sql 'alter system archive log current';
3>    backup 
4>    incremental level 2
5>    format '/db/rmanbak/data/%T_inc2_%U.bkp'
6>    tag 'weekly inc2 backup'
7>    database plus archivelog;
8> }
9> 
using target database control file instead of recovery catalog
sql statement: alter system archive log current


Starting backup at 26-FEB-13
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=494 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=16 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=516 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=33 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 02/26/2013 22:00:05
RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file /db/oracle/arch/1_1263_800686553.dbf
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

Recovery Manager complete.

归档日志/db/oracle/arch/1_1263_800686553.dbf不存在,导致2013-2-26的RMAN增量备份失败。

确认此文件不存在:

[[email protected] data]# ll /db/oracle/arch/1_1263_800686553.dbf
ls: cannot access /db/oracle/arch/1_1263_800686553.dbf: No such file or directory

查看所有RMAN备份日志(保留最近两周):

[[email protected] data]$ ll *.log
-rw-r--r--. 1 oracle oinstall  9450 Feb 12 22:35 20130212_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 10347 Feb 13 22:36 20130213_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 11700 Feb 14 22:36 20130214_220001-inc1.log
-rw-r--r--. 1 oracle oinstall 12210 Feb 15 22:36 20130215_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 13107 Feb 16 22:36 20130216_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 14073 Feb 17 22:37 20130217_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 24527 Feb 18 22:17 20130218_220001-inc0.log
-rw-r--r--. 1 oracle oinstall 33349 Feb 19 02:00 20130219_020001-obsolete.log
-rw-r--r--. 1 oracle oinstall  9450 Feb 19 22:36 20130219_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 10416 Feb 20 22:36 20130220_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 11383 Feb 21 22:36 20130221_220001-inc1.log
-rw-r--r--. 1 oracle oinstall 12279 Feb 22 22:37 20130222_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 13245 Feb 23 22:37 20130223_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 14210 Feb 24 22:38 20130224_220001-inc2.log
-rw-r--r--. 1 oracle oinstall 25402 Feb 25 22:16 20130225_220001-inc0.log
-rw-r--r--. 1 oracle oinstall 33258 Feb 26 02:00 20130226_020001-obsolete.log
-rw-r--r--. 1 oracle oinstall  1492 Feb 26 22:00 20130226_220001-inc2.log

搜索丢失的归档日志:

[[email protected] data]$ grep 1_1263_800686553.dbf *.log
20130225_220001-inc0.log:archived log file name=/db/oracle/arch/1_1263_800686553.dbf RECID=1249 STAMP=808334795
20130226_220001-inc2.log:ORA-19625: error identifying file /db/oracle/arch/1_1263_800686553.dbf

以上结果表明,在20130225_220001-inc0.log中该归档日志可能已经备份。下面进一步确认。

查看20130225_220001-inc0.log:

[[email protected] data]$ less 20130225_220001-inc0.log 

... ...
input archived log thread=1 sequence=1263 RECID=1249 STAMP=808334795
input archived log thread=1 sequence=1264 RECID=1247 STAMP=808334794
input archived log thread=1 sequence=1265 RECID=1248 STAMP=808334794
channel ORA_DISK_4: starting piece 1 at 25-FEB-13
channel ORA_DISK_4: finished piece 1 at 25-FEB-13
piece handle=/db/rmanbak/data/20130225_inc0_qro2stf6_1_1.bkp tag=WEEKLY INC0 BACKUP comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:01:59
channel ORA_DISK_4: deleting archived log(s)
... ...
archived log file name=/db/oracle/arch/1_1262_800686553.dbf RECID=1244 STAMP=808284272
archived log file name=/db/oracle/arch/1_1263_800686553.dbf RECID=1249 STAMP=808334795
archived log file name=/db/oracle/arch/1_1264_800686553.dbf RECID=1247 STAMP=808334794
archived log file name=/db/oracle/arch/1_1265_800686553.dbf RECID=1248 STAMP=808334794
... ...

列出备份的归档日志:

RMAN> list backup of archivelog until time 'sysdate - 1';


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
856     187.71M    DISK        00:01:49     25-FEB-13      
        BP Key: 922   Status: AVAILABLE  Compressed: YES  Tag: WEEKLY INC0 BACKUP
        Piece Name: /db/rmanbak/data/20130225_inc0_qro2stf6_1_1.bkp

  List of Archived Logs in backup set 856
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  ... ...
  1    1262    58178567   25-FEB-13 58246233   25-FEB-13
  1    1263    58246233   25-FEB-13 58270069   25-FEB-13
  1    1264    58270069   25-FEB-13 58271064   25-FEB-13
  1    1265    58271064   25-FEB-13 58273071   25-FEB-13
  ... ...

以上结果表明,序号为1263的归档日志已经备份在20130225_inc0_qro2stf6_1_1.bkp文件中。在本例中,inc0为RMAN增量备份的初始增量,全备时会删除归档日志。具体脚本如下:

[[email protected] ~]$ cat /dba/scripts/inc0.rman 
run{
   sql 'alter system archive log current';
   backup 
   incremental level 0
   format '/db/rmanbak/data/%T_inc0_%U.bkp'
   tag 'weekly inc0 backup'
   database plus archivelog delete input;
}

出现RMAN-06059错误提示归档日志丢失,可能是控制文件中记录的归档日志信息和实际存在的归档日志不同步。按理在RMAN备份时会自动同步控制文件,但该归档日志并非人为的丢失,故怀疑这里可能出现类BUG的异常,不知能否重现。此时需要手动运行crosscheckdelete命令,使之同步。

交叉校验所有归档日志:

RMAN> crosscheck archivelog all;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=56 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=51 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=504 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=14 device type=DISK
validation succeeded for archived log

Crosschecked 19 objects

validation failed for archived log
archived log file name=/db/oracle/arch/1_1263_800686553.dbf RECID=1245 STAMP=808334320
validation failed for archived log
archived log file name=/db/oracle/arch/1_1264_800686553.dbf RECID=1246 STAMP=808334457
Crosschecked 2 objects

删除失效的归档日志:

RMAN> delete expired archivelog all;

released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
released channel: ORA_DISK_4
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=56 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=51 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=504 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=14 device type=DISK
List of Archived Log Copies for database with db_unique_name DBTEST
=====================================================================

Key     Thrd Seq     S Low Time 
------- ---- ------- - ---------
1245    1    1263    X 25-FEB-13
        Name: /db/oracle/arch/1_1263_800686553.dbf

1246    1    1264    X 25-FEB-13
        Name: /db/oracle/arch/1_1264_800686553.dbf


Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=/db/oracle/arch/1_1263_800686553.dbf RECID=1245 STAMP=808334320
deleted archived log
archived log file name=/db/oracle/arch/1_1264_800686553.dbf RECID=1246 STAMP=808334457
Deleted 2 EXPIRED objects

手动执行RMAN增量备份,则可以正常完成。

Reference



blog comments powered by Disqus

Published

27 February 2013

Categories

Tags

Github