Oracle Automatic trace files cleanup:
In 11g we can clean/remove the trace files automatically using adrci.
adrci> help purge
Diagnostic data Purging in ADR is controlled by two attributes:
- SHORTP_POLICY which is used for automatically purging short-lived files, i.e. dump files, expressed in hours and defaults to 30 days.
- LONGP_POLICY which is used for automatically purging long-lived files, i.e. incidents, expressed in hours and defaults to 1 year.
adrci> show home
adrci> show home
ADR Homes:
diag/rdbms/DB1/DB11
diag/rdbms/DB3/DB31
diag/rdbms/qa/QA1
diag/rdbms/prd/DB11
diag/rdbms/DB2/DB21
Pick the home
adrci> set home diag/rdbms/DB1/DB11
adrci> show control
ADR Home = /icm01/u0001/app/diag/rdbms/DB1/DB11:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1182197510 720 8760 2011-12-12 21:30:04.349541 -05:00
To set the purging policy to 7 days:
adrci> set control (SHORTP_POLICY=168)
adrci> set control (LONGP_POLICY=168)
adrci> show control
ADR Home = /icm01/u0001/app/diag/rdbms/DB1/DB11:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1182197510 168 168 2013-01-14 11:21:51.600312 -05:00
To Manually purge all trace files older than 1 day (1440 mins):
Including core files: cdmp*
adrci> purge -age 1440
To purge core files older than 6 days
adrci> purge -age 8640 -type CDUMP
It might be needed to also run the following additional command:
adrci> purge -age 8640 -type UTSCDMP
-> to remove sub-folders >6 days-old having a name like "CDMP_
Purge XML based Alert log file:
adrci> purge -age 60 -type ALERT
do not clean up the Text-formatted alert.log file.
The ADRCI interface is only supposed to modify the XML-formatted alert file, not the Text-formatted alert file,