Sunday, March 27, 2011

UNIX/Linux script to remove old archived redo log files

UNIX/Linux script to remove old archived redo log files


This is an excerpt from the book "Oracle Shell scripting", a great source of UNIX scripts for file management.

The UNIX/Linux "find" command can be used to locate unwanted Oracle archived redo log files. Below is a script that will automatically remove all old archived redo log files from the in UNIX.


# Cleanup redo log files that are more than 7 days old

root> find $DBA/$ORACLE_SID/arch/*.log -mtime +7 -exec rm {} \;


Note that the first part of this script (before the –exec) displays all redo log files that are more than 7 days old.

root> find $DBA/$ORACLE_SID/arch/*.log -mtime +7

No comments:

Post a Comment