Saturday, November 27, 2010

Purging trace and dump files with Oracle 11g ADRCI

Oracle 11g uses the ADR (Automatic Diagnostic Repository) utility which is defined by the diagnostic_dest parameter. To access ADR, execute adrci from the UNIX prompt. We no longer have to manually remove trace files and core dumps, this is now all done automatically. How?
The MMON background process does it automatically based on a control date established for each database instance..
There are two time attributes which are used to manage the retention of information in ADR (in hours):
LONGP_POLICY (long term) defaults to 365 (8760 hours) days and relates to things like Incidents and Health Monitor warnings.
SHORTP_POLICY (short term) defaults to 30 (720 hours) days and relates to things like trace and core dump files
Log in to adrci. You must set the homepath to the Oracle database instances diag directory first before making changes. For example:
adrci
ADRCI: Release 11.2.0.1.0 - Production on Wed Oct 13 10:45:33 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
ADR base = "/u01/app/oracle"
adrci> show homepath
diag/rdbms/db11d/DB11D
diag/rdbms/dbua0/DBUA0
diag/clients/user_oracle/host_1240304075_11
diag/clients/user_unknown/host_411310321_11
diag/tnslsnr/panacea/listener
diag/tnslsnr/panacea/listener_db11d
adrci> set homepath diag/rdbms/DB11D
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/DB11D/db11d:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
3085591152 720 8760 2010-10-13 07:45:05.954963 -04:00 2010-10-06 19:24:19.114301 -04:00 1 2 76 1 2010-09-21 09:01:57.306537 -04:00
1 rows fetched
adrci> set control (SHORTP_POLICY =360)
adrci> set control (LONGP_POLICY=4380)
This will reduce the short term to 15 days and the long term to 180 days. MMON will automatically delete the designated files by the dates specified. You no longer have to monitor this space!