ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORA-19571: archived-log recid

ORA-19571: archived-log recid

原创 Linux操作系统 作者:it_newbalance 时间:2012-06-13 15:32:51 0 删除 编辑

数据库每日Rman备份,隔几日后,Rman备份会出现备份不成功的情况,手工删除一些归档日志后,方可正常Rman备份,错误信息如下
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup plus archivelog command at 06/12/2012 20:29:07

RMAN-03009: failure of backup command on c2 channel at 06/12/2012 19:45:54
ORA-19571: archived-log recid 270876 stamp 783295265 not found in control file

如何避免这种每隔几天就出现的Rman备份不成功且不用手工删除归档日志的问题,解决如下

(1) 一般这种问题可以通过增加控制文件信息的保留天数来规避,例如
SQL> alter system set control_file_record_keep_time=14;

(2) 如果问题仍然存在,在不手动删除归档的情况下执行
登录RMAN后,对归档路径执行 (假设归档日志路径在 /disk1/archive)

RMAN> catalog start with '/disk1/archive';

结合当前我维护的数据库服务器,处理如下:

(1) 登录数据库执行 并提供命令输出
SQL> show parameter control_file_record_keep_time

NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
control_file_record_keep_time integer 14

(2)RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oraprod/product/10.2.0/dbs/snapcf_GELCPRO.f'; # default

从执行的信息来看,应该是属于归档信息与控制文件中信息有冲突,该问题可以通过在每次备份之前执行
添加以下语句到备份脚本中,位置应该在RUN之前,对归档路径执行

catalog start with '/disk1/archive'; <----(假设归档日志路径在 /disk1/archive)

run {
.....

修改后的 rman backup script. 参看如下:

#!/bin/bash

cd `dirname $0`/..
. conf/define

RMAN=${ORACLE_HOME}/bin/rman
SQLPLUS=${ORACLE_HOME}/bin/sqlplus
DATE_TAG=`date +%Y%m%d`
BACKUP_LOG=${BACKUP_DB_TARGET}/db_${ORACLE_SID}_${DATE_TAG}.log
IDFILE=/tmp/full_db_backup_${ORACLE_SID}.id

/bin/touch ${IDFILE}
FLAG=`/bin/cat ${IDFILE}`

if [ -z ${FLAG} ] || [ ${FLAG} -eq 0 ] ; then
   /bin/echo "1" > ${IDFILE}
else
   if [ $# -eq 1 ] && [ $1 = "force" ] ; then
      /bin/echo "This script. is running now, but it'll start another process forced. pls check!"
   else
      /bin/echo "This script. is running, exit now. pls check!"|/usr/local/bin/email -f ${MAILFR} -s "`hostname` ${ORACLE_SID} \
                 full db backup fail" ${MAILTO}
      exit 1
   fi
fi

${RMAN} target / nocatalog msglog ${BACKUP_LOG} <crosscheck backup;
crosscheck copy;

report obsolete;
delete noprompt obsolete;

crosscheck archivelog all;
delete expired archivelog all;

# resolve ORA-19571: archived-log recid modified by liguoyin 20120613

catalog start with '/u01/oradata/gelcprod10g';

run {
  allocate channel c1 type disk;
  allocate channel c2 type disk;
  set limit channel c1 kbytes 1800000;
  set limit channel c2 kbytes 1800000;
  backup as compressed backupset format "${BACKUP_DB_TARGET}/db_${ORACLE_SID}_${DATE_TAG}_%s_%p_%t"
  database plus archivelog
  format "${BACKUP_DB_TARGET}/arch_${ORACLE_SID}_${DATE_TAG}_%s_%p_%t";
  release channel c1;
  release channel c2;
  }

sql "alter database backup controlfile to ''${BACKUP_DB_TARGET}/controlfile_${ORACLE_SID}_${DATE_TAG}.bak'' reuse";

exit

EOF

RSTAT=$?

if [ ${RSTAT} -eq 0 ] ; then
   BKSTAT=successfully
else
  BKSTAT=error
fi

/bin/echo "0" > ${IDFILE}


${SQLPLUS} /nolog <conn /as sysdba
whenever sqlerror exit failure
alter database backup controlfile to trace;
set linesize 200
set termout off
spool ${BASEDIR}/spool/tmp.sql
select '!cp -f '||c.value||'/'||upper(d.instance_name)||'_ora_'||a.spid||'.trc '||'${BACKUP_DB_TARGET}/controlfile_${ORACLE_SID}_${DATE_TAG}.sql' from v\$process a, v\$session b, v\$parameter c,v\$instance d,(select sid from v\$mystat where rownum=1) e where a.addr = b.paddr and b.sid= e.sid and c.name = 'user_dump_dest'
union all
select '!cp -f '||c.value||'/'||lower(d.instance_name)||'_ora_'||a.spid||'.trc '||'${BACKUP_DB_TARGET}/controlfile_${ORACLE_SID}_${DATE_TAG}.sql' from v\$process a, v\$session b, v\$parameter c,v\$instance d,(select sid from v\$mystat where rownum=1) e where a.addr = b.paddr and b.sid= e.sid and c.name = 'user_dump_dest';
spool off
@${BASEDIR}/spool/tmp.sql
exit
EOF


/bin/cat ${BACKUP_LOG}|/usr/local/bin/email -f ${MAILFR} -s "`hostname` ${ORACLE_SID} full db backup ${BKSTAT}" ${MAILTO}

## added to housekeep datapump rman back file.
find /u01/backup -type f -name "*.tar.gz" -mtime +31 -exec rm {} \;
 




 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24558279/viewspace-732691/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-03-28

  • 博文量
    143
  • 访问量
    699142