Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Delete old Archive log Unix script
Here's a script I use to delete all kinds of old logs and other files.
#!/bin/sh
#--------------------------------------------------------------------------=
-
# /oracle/tools/common/hskp
#
# This shell script=20
# 4. Purges backup logs, messages & error files older than 7 days;=20
# 5. Purges backup control file logs older than 7 days;
# 6. Purges backup alert file logs in $OBACKUP/backup_old older than 7 =
days;
# 7. Purges backup log files older than 7 days;
# 8. Purges backup alert file logs older than 7 days in backup_old.
# 9. Purges alert files in $OALERT older than 7 days.=20
#
# Usage: hskp <SID>
# =20
#
# Modifications
#
# 00MAY09 Edited for common usage by all instances
# Kristen Cameron
# 99AUG24 Fixed code for instances
# 99MAY03 Added code for instances
#
# 98NOV16 Modified from DBP1's hskp script=20
#
# 98OCT27 Modified from offline_backup.sh
# INAC, IMAG, (JL) =20
#
# 96SEP11 - Initial coding.
# GDS & Associates Systems Ltd. (GN)
#
#--------------------------------------------------------------------------=
-
echo " " echo "---------------------------------------------------" echo "/oracle/tools/common/hskp started" `date` echo "---------------------------------------------------"
if [ $# -lt 1 ]
then
echo
echo Usage: $0 instance_id
echo
exit 1
fi
ORACLE_SID=3D$1
export ORACLE_SID
ORAENV_ASK=3DNO
export ORAENV_ASK
. oraenv
=20
echo "Purging backup logs files on" `date` find /oracle/tools/$ORACLE_SID/log/backup* -mtime +7 -exec rm {} \; echo "Purging control file log files on" `date` find /oracle/tools/$ORACLE_SID/log/control*.log -mtime +7 -exec rm ={} \;
echo "Purging datafile log files on" `date` find /oracle/tools/$ORACLE_SID/log/datafile_*.log -mtime +7 -exec =rm {} \;=20
echo "Purging alert log files on" `date` find /oracle/tools/$ORACLE_SID/log/alertlog_*.log -mtime +7 -exec =rm {} \;
echo "Purging arch log files on" `date` find /oracle/tools/$ORACLE_SID/log/archlog_*.log -mtime +7 -exec rm ={} \;
echo "Purging alert files in $OBACKUP/backup_old on " `date`=20 find /opt1/$ORACLE_SID/backup_old/alert* -mtime +7 -exec rm {} \; echo "Purging alert files in $OALERT on " `date` find /oracle/oradata/$ORACLE_SID/trace/bdump/alert* -mtime +7 -exec =rm {} \;
If you have any questions, just email me.
>>> Michael.Ma_at_exodus.net 5/31/2000 >>>
Dear DBA,
I would appreciate had any Unix script to delete the old archive log = files.
Thanks for the advance,
Michael Ma.
--=20
Author: Michael Ma
INET: Michael.Ma_at_exodus.net=20
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may Received on Thu Jun 01 2000 - 10:18:12 CDT