Trace file maintainance in 9i and 10g


Hello,

Trace file maintenance is a part of DBA activity, to accomplish this script is given below.

I have created a script to delete the trace file automatically, you can schedule this in your crontab and trace file maintenance will be taken care.

Note:- You may customize this according to your need.

Here is the Script code.
--------------------------------

#!/bin/ksh

. /home/oracle/.profile

DATETIME=`date +%Y%m%d`
DBA_MAIL_GRP="ghufranahmedkhan@gmail.com"

#track script start time
echo "" > /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1
echo "$0: Script Start Time: `date`" >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1
echo "" >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1

#Deleting Trace Files on Production server older than 30 days
echo "\nDeleting Trace Files on Production server older than 30 days.." >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log
find /u01/app/oracle/admin/orcl/bdump/*.trc -mtime +30 -exec ls -ltr {} \; >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1
find /u01/app/oracle/admin/orcl/bdump/*.trc -mtime +30 -exec rm {} \; >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1

mailx -s "Following Trace file deleleted on Production server: `hostname` ." $DBA_MAIL_GRP < /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log



From 11g onward this is taken care automatically by the utility called adrci( automatic dignostic recovery command interface)



Thankyou











Comments

Popular posts from this blog

ORACLE BACKUP AND RECOVERY