Thursday, November 01, 2012

Purging Oracle ADR (Automatic Diagnostic Repository) logs

 

When ADR logs become unexpectedly large, or too many (as in too many databases for one host), then manual purging is necessary. Following Scripts will be of handy during this time.


#!/bin/ksh
# Purge ADR logs
# Call oraenv first (or at least set $ORACLE_HOME)

# -- Customize the following variables
D1=1440    # to purge older than one day
D5=7200    # to purge older than five days
D7=10080   # to purge older than seven days
DD=        # set to your ADR_BASE (Ex. /app/oracle)
HP=        # set to your ADR_HOME (Ex. diag/rdbms/<dbname>/<instname>)

$ORACLE_HOME/bin/adrci <<_EOF
set base $DD
set homepath $HP
show homes
purge -age $D7 -type alert
purge -age $D7 -type incident
purge -age $D7 -type trace
purge -age $D7 -type cdump
quit
_EOF

No comments: