生产库数据库登陆异常,通过排查发现归档无法删除,使用rman调用删除脚本如下报错:
RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process
archived log file name=+ARCH/MARC/ARCHIVELOG/2022_09_21/thread_2_seq_3641.3274.1116019413 thread=2 sequence=3641
RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process
archived log file name=+ARCH/MARC/ARCHIVELOG/2022_09_21/thread_2_seq_3642.3289.1116019417 thread=2 sequence=3642
RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process
archived log file name=+ARCH/MARC/ARCHIVELOG/2022_09_25/thread_2_seq_3643.3294.1116326785 thread=2 sequence=3643
RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process
archived log file name=+ARCH/MARC/ARCHIVELOG/2022_09_25/thread_2_seq_3644.3315.1116326783 thread=2 sequence=3644
经分析发现改数据库使用ogg传输数据开启附加日志,导致归档无法删除,通过以下操作恢复正常
SQL> select force_logging,supplemental_log_data_min from v$database;
FORCE_LOGGING SUPPLEME
--------------------------------------- --------
YES YES
SQL> alter database drop supplemental log data;
Database altered.
SQL> select force_logging,supplemental_log_data_min from v$database;
FORCE_LOGGING SUPPLEME
--------------------------------------- --------
YES NO
SQL> select capture_name, status, captured_scn, applied_scn, capture_type from dba_capture;
CAPTURE_NAME
--------------------------------------------------------------------------------
STATUS CAPTURED_SCN APPLIED_SCN CAPTURE_TY
-------- ------------ ----------- ----------
OGG$CAP_EX1
DISABLED 1597101500 1597101424 LOCAL
SQL>
SQL>
SQL> exec dbms_capture_adm.drop_capture(capture_name =>'OGG$CAP_EX1');
PL/SQL procedure successfully completed.