| |
 |
|
Oracle Tips by Burleson Consulting
|
A step-by-step approach to
deleting unwanted UNIX files
When writing UNIX scripts to automatically delete obsolete Oracle
trace files, audit files, dump files and archived redo logs, it is a
good idea to carefully develop the UNIX script through iteration,
getting each piece working. Remember, even seasoned UNIX guru’s will
not write a complex command until each component is tested.
We start by going to the archived redo log directory and finding all
redo log files that are more than 7 days old. In this example, we
take a cold backup each night, and the DBA has not use for elderly
redo log files.
root> cd $DBA/$ORACLE_SID/arch
root> find . -mtime +7
./archlog2251.arc
./archlog2252.arc
./archlog2253.arc
./archlog2254.arc
Now that we have the list of files, we can add the UNIX rm command
to this syntax to automatically remove all files that are more than
7 days old. In this case, we can use either the –exec or the xargs
commands to remove the files.
find . –mtime +7 –exec rm {} \;
|
Download your Oracle scripts now:
www.oracle-script.com
The
definitive Oracle Script collection for every Oracle professional DBA
|
|