SQL> select * from v$version;BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionPL/SQL Release 11.2.0.3.0 - ProductionCORE 11.2.0.3.0 ProductionTNS for Linux: Version 11.2.0.3.0 - ProductionNLSRTL Version 11.2.0.3.0 - Production
11g dataguard 环境中用rman删除主库的归档,出现 RMAN-08137:
WARNING: archived log not deleted, needed for standby or upstream capture process
通过下述两个sql检查,发现主库的归档都已经应用到standby库。
SQL> select max(sequence#) from v$archived_log;
SQL>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
检查发现数据库开启了附加日志:
SQL> select force_logging,supplemental_log_data_min from v$database;
FORCE_LOGGING SUPPLEMENTAL_LOG_DATA_MIN
------------- -------------------------
YES YES
附加日志是goldengate同步数据时用到的,现在数据已经迁移完毕。可以关闭掉附加日志。
SQL> alter database drop supplemental log data;
Database altered
检查dba_capture,发现有记录
SQL> select capture_name, status, captured_scn, applied_scn, capture_type
2 from dba_capture;
CAPTURE_NAME STATUS CAPTURED_SCN APPLIED_SCN CAPTURE_TYPE
------------------------------ -------- ------------ ----------- ------------
OGG2$EXT_EMCF3359B3 DISABLED LOCAL
利用 dbms_capture_adm.drop_capture删除相关记录
SQL> exec dbms_capture_adm.drop_capture(capture_name =>'OGG2$EXT_EMCF3359B3');
PL/SQL procedure successfully completed
删除归档正常。
RMAN> delete noprompt archivelog until time 'sysdate-7';
...
Deleted 49 objects