11g dataguard 环境中用rman删除主库的归档,出现 RMAN-08137:
WARNING: archived log not deleted, needed for standby or upstream capture process
通过下述两个sql检查,发现主库的归档都已经应用到standby库
select max(sequence#) from v$archived_log;
select max(sequence#) from v$archived_log where applied='YES';
尝试用下述命令删除7天前的归档
RMAN>crosscheck archivelog all;
RMAN>delete noprompt archivelog until time 'sysdate-7';
错误如下:
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
检查发现数据库开启了附加日志:
select force_logging,supplemental_log_data_min from v$database;
FORCE_LOGGING SUPPLEMENTAL_LOG_DATA_MIN
------------- -------------------------
YES YES
附加日志之前同步数据时用到的,现在不用了可以关闭掉附加日志
alter database drop supplemental log data;
Database altered
检查dba_capture发现有记录:
select capture_name, status, captured_scn, applied_scn, capture_type from dba_capture;
利用dbms_capture_adm.drop_capture删除相关记录:
exec dbms_capture_adm.drop_capture(capture_name =>'......');
PL/SQL procedure successfully completed
删除归档正常
RMAN> delete noprompt archivelog until time 'sysdate-7';
方法二:
最后加上force关键字,手动执行delete noprompt force archivelog until time 'sysdate-14'; 成功将归档删除!