About

Martin Klier

usn-it.de

Oracle: Manage the lifetime of trace files et al. with ADRCI (purge interval)

Oracle Database 11g and above offers a great feature by managing its trace files by itself. In combination with the new “incident” system, a tool was necessary to handle those without enterprise manager: ADRCI. It has several other cool functions, such as a tail-like log file display, but today I just want to show a very short reference for the lifetime management of trace files and their friends.

1. Basics

The file lifetime for alerts, traces, incidents and dumps is calculated staring from the last modification done by Oracle. For example, a trace file can be used for hours (and days), but it will be deleted X hours after creation. Following this logic, a running logfile like alert.log will never be purged.

Keep in mind, the way how to work with times is confusing: The policies are in hours, the purging command accepts minutes.

2. Look up current configuration

Of course it’s useful to see how we are confugured. SHORTP_POLICY is for trace files and other things generated automatically. Incidents and other stuff done by purpose is cleaned following the LONGP_POLICY. The other fields (there are more than I am showing here) should be self-explanatory.

adrci> set home diag/rdbms/db/DB
adrci> show control
ADR Home = /u01/app/oracle/product/11.2.0/db_1/diag/rdbms/db/DB:
****************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY        
-------------------- -------------------- --------------------
3705546879           720                  8760

These default values mean, that trace files are purged after 720 hours, and the other stuff is vaporized after 8760 hours (= 1 year).

3. Changes

To change them, the syntax is simple:

adrci> set control (SHORTP_POLICY = 48)
adrci> set control (LONGP_POLICY = 48)

Now its 48 hours for both.

4. Purging manually

If you want to get rid of old files manually (and independently from the auto purge policies specified above), just do one, some, or all of those. But keep in mind, that’s 48 hours in MINUTES now!

adrci> purge -age 2880 -type incident
adrci> purge -age 2880 -type ALERT
adrci> purge -age 2880 -type TRACE
adrci> purge -age 2880 -type CDUMP
adrci> purge -age 2880 -type HM

5. Learn more

A good introduction for ADRCI is Uwe Hesse’s ADRCI: A survival guide for the DBA

 

Good luck with keeping your diag directory small,
Martin Klier

Oracle Grid Infrastructure: How to recover from a messed up ASM/CSSD diskstring
Linux Network bonding – setup guide

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.