Friday, September 18, 2009

Clean Oracle 11g diag dir with adrci

Cleaning the diag directory in Oracle 11g can be done with using cronjob and with embedded adrci commands. Adrci is Oracles new interface for working with and managing incidents. To keep your diag directory from filling up you can set a default purge script. An example is below

Cronjob.
02 04 * * * /var/opt/oracle/bin/clean_trc_adrci.sh >/tmp/clean_trc_adrci.log 2>&1

Script:
#!/bin/bash
export ORACLE_SID=test
export ORAENV_ASK=NO
# keep 7 days of incidents
. oraenv
$ORACLE_HOME/bin/adrci << CMD
set homepath diag/rdbms/test/test
set home diag/rdbms/test/test
purge -age 10080
CMD

No comments:

Post a Comment