RMAN> show ARCHIVELOG DELETION POLICY ; RMAN configuration parameters for database with db_unique_name ORCL are: CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default SQL> set linesize 200; select * from v$flash_recovery_area_usage where FILE_TYPE='ARCHIVED LOG'; FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES CON_ID ----------------------- ------------------ ------------------------- --------------- ---------- ARCHIVED LOG 12.27 0 21 0
重新设置archivelog的删除策略
RMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;
SQL> set linesize 200; select * from v$flash_recovery_area_usage where FILE_TYPE='ARCHIVED LOG'; SQL> FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES CON_ID ----------------------- ------------------ ------------------------- --------------- ---------- ARCHIVED LOG 12.27 12.27 21 0
我们可以看到随着我们改变归档日志的删除策略PERCENT_SPACE_RECLAIMABLE这个字段从0变成了12.27%。
需要说明的是可以被自动删除的归档日志不会在 report obsolete中报告。
下面的sql可以查询所有在备库上应用的归档日志:
select a.thread#, a.sequence#, a.applied from v$archived_log a, v$database d where a.activation# = d.activation# and a.applied='YES';
如果在中有FRA,空间压力,这些日志将被自动删除,在数据库的alert.log 从将会看到类似下面的提示:
Deleted Oracle managed file /opt/app/oracle/FRA/<DB_NAME>/archivelog/2020_05_30/o1_mf_1_151_6y71q675_.arc Deleted Oracle managed file /opt/app/oracle/FRA/<DB_NAME>/archivelog/2020_05_31/o1_mf_1_151_6y87pzg4_.arc