Posts

Showing posts from November, 2018

Cleanup Oracle ADR trace files on Linux

Here's a nice loop cleanup the Oracle DB trace files on Linux with the adrci utility.

#!/bin/bash
#cleanup Automatic Diagnostic Repository (i.e trace files)

#set oracle_home (have a script with your home info)
source ~/OracleHomeScript.sh

#list current repo size
echo ""
echo "##############size before############"
du -shx /u01/app/oracle/diag

echo ""
echo "Listing diag directory homes..."
echo ""
ADR_HOMES=`adrci exec="show homes" |grep -v "ADR Homes:"`
adrci exec="show homes" |grep -v "ADR Homes:"
echo ""
echo ""

#Set-up loop for each home
#

for f in $ADR_HOMES
do
echo "purging $f older than 1 week"
#Slow ADRCI Execution When Purging Files After Upgrade to 12.2 (Doc ID 2335738.1)
adrci exec="set homepath $f; purge -age 10080 -nolog"
done

#list ADR repo size after
echo ""
echo "##############size after############"
du -shx /u01/app/o…