Commands to Delete Old Aged Oracle Trace Files(.trc, .trm) and Audit(.aud) Files


In this post I am going to explain the command to delete old trace, Audit files. You have to periodically clean up these trace, audit file locations to avoid the file system get filled with files.
In this below command you have change the trace directory depending on your database background_dump_destination location. Also you need to change the -mtime parameter(modified time) value. In below commands I have used 3 days. 

Unix Commands

find /opt/oracle/diag/rdbms/dbname/instance_name/trace -name "*.trc" -mtime +3 -exec rm {} \;
find /opt/oracle/diag/rdbms/dbname/instance_name/trace -name "*.trm" -mtime +3 -exec rm {} \;
find /opt/oracle/diag/rdbms/dbname/instance_name/trace -name "*.gz" -mtime +3 -exec rm {} \;
find /opt/oracle/diag/tnslsnr/hostname/listener_dbname/alert -name "log*xml" -mtime +3 -exec rm {} \;
 find . -name "*.aud" -mtime +7 -exec rm -f {} \;

Below error “arg list too long” can be sorted out by find command.

oracle..> rm -rf  *.aud
ksh: /usr/bin/rm: arg list too long


find . -name '*.aud' -exec rm {} +



Post a comment Copyright 2011-20 All Rights Reserved | Site Map | Contact | Disclaimer