问题:
客户环境12.2 dg备库环境,定时清理归档脚本并未正常清理归档日志文件。
观察日志可以发现存在如下信息
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process .
一般情况下,如果在备库环境或者主库环境,配置归档清理测量后,DG环境未应用归档将不允许删除。
本次排查RMAN清理归档策略默认,且无法删除的归档日志在DG视图v$archived_log 中applied列为YES
匹配MOS
RMAN-08137 while Deleting Archived Logs from Standby (文档 ID 2169282.1)
CAUSE
log_archive_dest_2 on standby which points to primary database was deferred :
log_archive_dest_2 <SERVICE_NAME> ASYNC NOAFFIRM valid_for=(online_logfile,primary_role) db_unique_name=<SERVICE_NAME>
log_archive_dest_state_2= DEFER
This is functionality change in Oracle12c with fix of <bug 16082541>: RMAN DELETES ARCHIVELOGS WHICH HAVE NOT BEEN APPLIED TO A DEFERRED STANDBY
SOLUTION
1. Enable the destination:
SQL>alter system set log_archive_dest_state_2 = ENABLE;
Once destination 2 is enabled , then Please run the archivelog deletion command on standby from RMAN .
2. If the destination should not be considered, unset the destination rather setting it's state to DEFER.
实际情况发现,DG配置远程归档参数,指向主库,且远程归档线程状态为DEFER,按照文档提示,修改为ENABLE后,手工执行归档清理脚本后正常。