Difference between revisions of "Adrci"

From dbawiki
Jump to: navigation, search
(Use command line interface from shell)
Line 1: Line 1:
 +
* [http://intermediatesql.com/oracle/oracle-11g-xml-alert-logs-surprise-they-are-actually-more-convenient-to-work-with/ Convenient access to adrci log files]
 
===adrci===
 
===adrci===
 
A useful way to keep the purging of trace files under control.<br />
 
A useful way to keep the purging of trace files under control.<br />

Revision as of 15:18, 10 August 2015

adrci

A useful way to keep the purging of trace files under control.
With an Oracle database environment setup, type:

adrci

To get out, type:

adrci> exit

To get help, type:

adrci> help

To see current setup, type:

adrci> show control

SHORTP_POLICY and LONGP_POLICY are number of hours to keep trace files and alert files respectively. These can be changed by typing:

set control (SHORTP_POLICY=240)

Trace files will now be deleted after 10 days.
If space is running low, you can manually delete trace files like this:

purge -age 3600 -type TRACE

This deletes all trace files older than 1 day (note the age parameter is minutes, not hours).

Use command line interface from shell

adrci exec="show homes"
adrci exec="set home diag/tnslsnr/ravjde01/listener_ravjde1;show control"
adrci exec="set home diag/tnslsnr/ravjde01/listener_ravjde1;set control (shortp_policy=360,longp_policy=720);purge;show control;"

Shell script to purge ADR data

Found here

# Purge ADR contents (adr_purge.sh)
purge_log () {
purge_min=$(( 24 * 60 * $2 ))
echo “INFO: purging $1 older than $2 days”
adrci exec=”set homepath $file_line;purge -age $purge_min -type $1″
}

echo “INFO: adrci purge started at `date`”
adrci exec=”show homes”|grep -v : | while read file_line
do
echo “INFO: adrci purging diagnostic destination ” $file_line
echo “——————————————————————————-”
purge_log ALERT 365
purge_log INCIDENT 273
purge_log TRACE 120
purge_log CDUMP 75
purge_log HM 75
echo “——————————————————————————-”
done
echo
echo “INFO: adrci purge finished at `date`”