12c DataGuard 無法刪除歸檔日誌
一、環境描述
Oracle 12c 單實例DataGuard
Rhel 7.3
二、測試過程
主庫操作
1.關閉DG,切換日誌
SQL> alter system set log_archive_dest_state_2=defer;
System altered.
SQL> show parameter log_archive_dest_state_2
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_2 string DEFER
log_archive_dest_state_20 string enable
log_archive_dest_state_21 string enable
log_archive_dest_state_22 string enable
log_archive_dest_state_23 string enable
log_archive_dest_state_24 string enable
log_archive_dest_state_25 string enable
log_archive_dest_state_26 string enable
log_archive_dest_state_27 string enable
log_archive_dest_state_28 string enable
log_archive_dest_state_29 string enable
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL>
2.rman刪除歸檔
RMAN> list archivelog all;
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - --------------------
40 1 31 A 26-NOV-2017 19:15:13
Name: /oracle/arch/1_31_958415134.dbf
42 1 32 A 26-NOV-2017 19:22:34
Name: /oracle/arch/1_32_958415134.dbf
RMAN> delete noprompt archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=39 device type=DISK
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oracle/arch/1_32_958415134.dbf thread=1 sequence=32
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - --------------------
40 1 31 A 26-NOV-2017 19:15:13
Name: /oracle/arch/1_31_958415134.dbf
deleted archived log
archived log file name=/oracle/arch/1_31_958415134.dbf RECID=40 STAMP=961096954
Deleted 1 objects
RMAN>
三、小結
當我們DG環境,人為或者異常情況導致DG異常,沒有被應用的歸檔日誌是不會被刪除的。這裏可能會出現一個問題就是
當我們的磁盤空間緊張,可能生成大量的日誌占滿磁盤,導致數據庫無法寫入的問題。需要我們有監控系統,發現DG異常及時處理
,千萬不要等著影響業務才被動的去處理。
12c DataGuard 無法刪除歸檔日誌