Cleanup-Logfiles-Linux

# Cleanup trace files more than 7 days old

root> find $DBA/$ORACLE_SID/bdump/*.trc -mtime +7 -exec rm {} \;
root> find $DBA/$ORACLE_SID/udump/*.trc -mtime +7 -exec rm {} \;
root> find $DBA/$ORACLE_SID/cdump/*.trc -mtime +7 -exec rm {} \;

/usr/bin/find /u01/app/oracle/product/crs/log/test040/client/css*.log -mtime +31 -exec rm {} ;



# Cleanup trace and dump files over 14 days old

for ORACLE_SID in `cat /etc/oratab|egrep ':N|:Y'|grep -v *|cut -f1 -d':'`
do
   ORACLE_HOME=`cat /etc/oratab|grep ^$ORACLE_SID:|cut -d":" -f2`
   DBA=`echo $ORACLE_HOME | sed -e 's:/product/.*::g'`/admin
   /usr/bin/find $DBA/$ORACLE_SID/bdump -name *.trc -mtime +14 -exec rm {} ;


No comments: