Posts

Showing posts from January, 2016

Trace and trm files cleanup script

#By : Anil Vejendla Trace & Trm files cleanup older than 30 days export ORAENV_ASK='NO' #for ORACLE_SID in `ps -ef | grep pmon | grep -v grep | cut -d '_' -f 3-`;do for ORACLE_SID in `egrep -v '^[ \t]*$|^#' /etc/oratab | cut -d ':' -f 1`;do export ORACLE_SID . oraenv > /dev/null echo " ============================================== Trace files .trc & .trm  removal for $ORACLE_SID: ============================================== " bdump=`sqlplus -s / as sysdba <<EOF set head off;     set feedback off;     set verify off;     select value from v\\$parameter where name='background_dump_dest'; EOF` echo $bdump # Make sure the directories are valid and cleanup the files    if [ -d ${bdump} ];  then      echo "Removing old files at `date +%Y%m%d%H%M` for ${ORACLE_SID}" ;      echo "No of trace files Before Cleanup `ls -l ${bdump} | wc -l`";