环境:
centos 6.5 X64
Oracle 11g Enterprise Edition Release 11.2.0.2.0
故障现象:
rman自动备份脚本失败,报错现象:
Starting backup at 30-JUL-15
current log archived
released channel: disk1
released channel: disk2
released channel: disk3
released channel: disk4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 07/30/2015 23:00:27
RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
ORA-19625: error identifying file /data0/oracle/database/archive/1_985092_843387931.arc
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Recovery Manager complete
从报错现象上看,是因为归档日志 985092 文件被删除了。
分析主要原因是因为此数据库为dataguard 架构,同事做了v$archived max(SEQUENCE#)-500保留归档而且是每小时执行一次删除归档日志。因为晚上11点整点开始备份,也就说当整点rman开始执行run{}并分配通道后已经是23:04以后了,但是删除脚本已经在整点23:00已经执行。 这个时候rman archive backup 脚本执行 input archived log thread=1 sequence=985092 文件时发现文件不存在。导致rman 归档备份失败。
查看时间:
SQL> SELECT APPLIED,to_char(FIRST_TIME, ‘yyyy-mm-dd hh24:mi:ss‘) as FIRST_TIME,
2 to_char(NEXT_TIME, ‘yyyy-mm-dd hh24:mi:ss‘) as NEXT_TIME
3 from V$ARCHIVED_LOG
4 where SEQUENCE#= 985092;
APPLIED FIRST_TIME NEXT_TIME
--------- ------------------- -------------------
YES 2015-07-30 16:03:06 2015-07-30 16:03:12
NO 2015-07-30 16:03:06 2015-07-30 16:03:12
处理俩种方法:
1、综合考虑服务器硬盘存储空间【言外之意就是数据库要保留一天的归档日志】,取消自动删除归档日志脚本。让rman 做归档备份完成之后自动删除归档日志。
2、修改rman 归档备份时间和备份脚本,如:23:10开始备份。
如:
RUN {
allocate channel disk1 type disk maxpiecesize 4000M;
allocate channel disk2 type disk maxpiecesize 4000M;
sql ‘alter system archive log current‘;
backup archivelog all delete input format ‘/opt/oracle/backup/arch_backup/archbackup/%d_arch_%s_%p_%h.arh‘ filesperset = 50;
# Control file backup
backup as compressed backupset format ‘/opt/oracle/backup/arch_backup/archbackup/CF_%t_%s_%p_D%T.ctl‘ current controlfile;
}
如果空间够用,就推荐使用第二种,这样数据可用范围大。