Oracle – what is filling up my diag directory and sub-directories

Oracle – what is filling up my diag directory and sub-directories

sqlplus / as sysdba
SQL> show parameter diag
NAME                     TYPE     VALUE
———————————— ———– ——————————
diagnostic_dest              string     /oracle/SILVER
[oracle@silver ~]$ cd /oracle/SILVER/diag
[oracle@silver diag]$ ls
asm  clients  crs  diagtool  lsnrctl  netcman  ofm  rdbms  tnslsnr

Ok, so which directory is filling up?

[oracle@silver ~]$ cd /oracle/SILVER/diag
[oracle@silver diag]$ ls
asm clients crs diagtool lsnrctl netcman ofm rdbms tnslsnr
[oracle@silver diag]$ du -sh *
4.0K asm
4.0K clients
4.0K crs
4.0K diagtool
296.0M lsnrctl
4.0K netcman
4.0K ofm
8.2M rdbms
5.3M tnslsnr

Ok, so it is “lsnrctl” dir – lots of XML log files produced some times.
You can purge them the old fashion way – cd into the dir and “rm” – or use Oracle’s “adrci”
Here’s a bash (works with korn etc. too) script that will at least purge old stuff from diag mounts.

# Purge ADR contents (adr_purge.bash)
echo “adrci purge started at `date`”
adrci exec=”show homes”|grep -v : | while read file_line
do
echo “adrci purging diagnostic destination ” $file_line
echo “purging ALERT older than 90 days”
adrci exec=”set homepath $file_line;purge -age 129600 -type ALERT”
echo “purging INCIDENT older than 10 days”
adrci exec=”set homepath $file_line;purge -age 14400 `-type INCIDENT”
echo “purging TRACE older than 10 days”
adrci exec=”set homepath $file_line;purge -age 14400 -type TRACE”
echo “purging CDUMP older than 10 days”
adrci exec=”set homepath $file_line;purge -age 14400 -type CDUMP”
echo “purging HM older than 10 days”
adrci exec=”set homepath $file_line;purge -age 14400 -type HM”
echo “”
done
echo
echo “adrci purge finished at `date`”

Leave a Comment

Scroll to Top