Managing and purging tracefiles:
Now to the management of tracefiles. You may notice that 11g creates lots of tracefiles that need to be purged from time to time. In fact, this is done automatically, but you may want to change the default purge policy:
adrci> show tracefile -rt01-JUN-11 10:31:48 diag/rdbms/orcl/orcl/trace/orcl_mmon_2106.trc
01-JUN-11 09:43:43 diag/rdbms/orcl/orcl/trace/orcl_ckpt_2100.trc
01-JUN-11 09:22:13 diag/rdbms/orcl/orcl/trace/alert_orcl.log
01-JUN-11 09:22:11 diag/rdbms/orcl/orcl/trace/orcl_diag_2088.trc
01-JUN-11 09:22:10 diag/rdbms/orcl/orcl/trace/orcl_ora_2299.trc
01-JUN-11 09:22:10 diag/rdbms/orcl/orcl/incident/incdir_6201/orcl_ora_2299_i6201.trc
01-JUN-11 09:18:47 diag/rdbms/orcl/orcl/trace/orcl_ora_2236.trc
01-JUN-11 09:18:47 diag/rdbms/orcl/orcl/incident/incdir_6153/orcl_ora_2236_i6153.trc
01-JUN-11 09:17:19 diag/rdbms/orcl/orcl/trace/orcl_dbrm_2090.trc
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1335663986 720 8760 2011-05-27 10:16:46.997118 +02:00 1 2 80 1 2011-05-27 10:16:46.997118 +02:00
1 rows fetched
The ordinary tracefiles will stay for 30 days (720 hours), while files like incident files stay one year (8760 hours) by default. We can change that policy with for example:
adrci> set control (SHORTP_POLICY = 360)
adrci> set control (LONGP_POLICY = 4380)
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1335663986 360 4380 2011-06-01 11:42:17.208064 +02:00 1 2 80 1 2011-05-27 10:16:46.997118 +02:00
1 rows fetched
Also, we may want to purge tracefiles manually. Following command will manually purge all tracefiles older than 2 days (2880 minutes):
adrci> purge -age 2880 -type trace