UNIX scripts to clean-up old trace and log files
Here is an example of a
UNIX script for keeping the archived redo log directory free of elderly
files. As we know, it is
important to keep room in this directory, because Oracle may “lock-up”
if it cannot write a current redo log to the archived redo log filesystem.
This script could be used in coordination with Oracle Recovery Manager (rman)
to only remove files after a full backup has been taken.
Now that we see how to
do the cleanup for an individual directory, we can easily expand this
approach to loop through every Oracle database name on the server (by
using the oratab file), and remove the files from each directory. If you
are using Solaris the oratab is located in /var/opt/oratab while HP/UX and
AIX have the oratab file in the /etc directory.
The above script loops
through each database, visiting the bdump, udump and audit directories,
removing all files more than 2 weeks old.
If you like Oracle
tuning, you might enjoy my latest book “Oracle Tuning: The DefinitiveReference” by Rampant TechPress. (I don’t think
it is right to charge a fortune for books!) and you can buy it right now
at this link: