环境描述:
11.2.0.4
问题描述:
前几天碰到归档清除命令报错,总结了一下通用排查思路,举一反三
触发命令:DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-3';
报错内容:
RMAN-08137 "WARNING: archived log not deleted, needed for standby or upstream capture process"
archived log file name=+ARCDG/xxx/archivelog/2020_07_12/thread_2_seq_2740.5670.1045582327 thread=2 sequence=2740
报错分析:
8137, 3, "WARNING: archived log not deleted, needed for standby or upstream capture process"
// *Cause: An archived log that should have been deleted was not as it was
// required by upstream capture process or Data Guard.
// The next message identifies the archived log.
// *Action: This is an informational message. The archived log can be
// deleted after it is no longer needed. See the
// documentation for Data Guard to alter the set of active
// Data Guard destinations. See the documentation for
// Streams to alter the set of active streams.
从报错看是有备库或者OGG、CDC和Streams Replication等类似归档复制或者抽取进程占用了归档文件。需要主库更新信息说明归档已经释放才可以正常清理,报错有两种情况会触发
1)V$ARCHIVED_LOG.NEXT_CHANGE# is GREATER THAN the required SCN
2)V$ARCHIVED_LOG.APPLIED column is NO
问题原因:
我的环境是因为之前配置了ADG,现状是DG备库已经下线,但是主库配置未清理。导致归档日志的状态还是持续未同步到备库的状态。
解决方案:
知道了原因解决的方法也就有了,有以下几种方案都可以解决,可以任选一种:
1) 修改删除语句,这种方案比较暴力
delete noprompt force archivelog all completed before 'SYSDATE-1';
2) reset DG配置参数
log_archive_config
log_archive_dest and/or log_archive_dest_n with "service="
log_archive_dest_state_n
alter system reset或者alter system set log_archive_config='' scope=both sid='*'类似的命令解决。
3) 关闭_deferred_log_dest_is_valid参数,不进行状态校验
由于我的环境中NBU没法修改脚本,解决方案2实行后短时间也没有效果,我采用的是方案3,可以在线修改直接生效。
问题总结:
参考文档:Oracle "Capture" and the RMAN-08137 WARNING (Doc ID 1581365.1)