| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Delete old Archive log Unix script
I'm not unix specialist but here is a script used last year.
HTH Franck
COUNT=`cut -c37-39 $COM/list`
rm $COM/list
cd /u01/PROD_ARCH
date > $COM/datearch.lis
DAY=`cut -c1-3 $COM/datearch.lis`
rm $COM/datearch.lis
if [ "$DAY" = "Mon" ]; then
echo " today is monday "
find /u01/PROD_ARCH -ctime +4 -type f -print > $COM/delarch.lis
cut -c16-31 $COM/delarch.lis > $COM/cutlis
cd /u01/PROD_ARCH
#
while true
do
df > $COM/filelis.list
cat $COM/filelis.list | grep u01 > $COM/list
rm $COM/filelis.list
COUNT=`cut -c37-39 $COM/list`
rm $COM/list
if [ "$COUNT" -gt 92 ]
then
EMPTY=`cat $COM/delarch.lis`
if [ "$EMPTY" = "" ]
then
date >> /ops/log/emergency.log
ls | head -n3 >> /ops/log/emergency.log
cat /ops/log/emergency.log | xargs -t -I {} rm {}
sleep 10
fi
else
break
fi
done
#
cat $COM/cutlis | xargs -t -I {} rm {}
echo " deletion is done let's wait 15 minutes "
echo " `date` "
rm $COM/delarch.lis
rm $COM/cutlis
exit
if [ "$DAY" = "Sun" ]; then
echo ' Today is sunday'
find /u01/PROD_ARCH -ctime +3 -type f -print > $COM/delarch.lis
cut -c16-31 $COM/delarch.lis > $COM/cutlis
cd /u01/PROD_ARCH
while true
do
df > $COM/filelis.list
cat $COM/filelis.list | grep u01 > $COM/list
rm $COM/filelis.list
COUNT=`cut -c37-39 $COM/list`
rm $COM/list
if [ "$COUNT" -gt 92 ]
then
EMPTY=`cat $COM/delarch.lis`
if [ "$EMPTY" = "" ]
echo $EMPTY
then
date >> /ops/log/emergency.log
ls | head -n3 >> /ops/log/emergency.log
cat /ops/log/emergency.log | xargs -t -I {} rm {}
sleep 10
fi
else
break
fi
done
cat $COM/cutlis | xargs -t -I {} rm {}
echo " deletion is done let's wait 15 minutes"
echo " `date`"
rm $COM/delarch.lis
rm $COM/cutlis
exit
else
echo " Normal day of the week"
find /u01/PROD_ARCH -ctime +2.1 -type f -print > $COM/delarch.lis
cut -c16-31 $COM/delarch.lis > $COM/cutlis
cd /u01/PROD_ARCH
#
while true
do
df > $COM/filelis.list
cat $COM/filelis.list | grep u01 > $COM/list
rm $COM/filelis.list
COUNT=`cut -c37-39 $COM/list`
rm $COM/list
echo $COUNT
if [ "$COUNT" -gt 92 ]
then
EMPTY=`cat $COM/delarch.lis`
if [ "$EMPTY" = "" ]
then
date >> /ops/log/emergency.log
ls | head -n3 >> /ops/log/emergency.log
cat /ops/log/emergency.log | xargs -t -I {} rm {}
sleep 15
fi
else
break
fi
done
#
cat $COM/cutlis | xargs -t -I {} rm {}
echo " deletion is done let's wait 15 minutes"
echo " `date`"
rm $COM/delarch.lis
rm $COM/cutlis
exit
|--------+-----------------------> | | Michael Ma | | | <Michael.Ma_at_e| | | xodus.net> | | | | | | 00-05-31 | | | 19:58 | | | Please | | | respond to | | | ORACLE-L | | | | |--------+-----------------------> >----------------------------------------------------------------------------| | | | To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> | | cc: (bcc: Franck Vasseur/im/esa/ingerrand) | | Subject: Delete old Archive log Unix script | >----------------------------------------------------------------------------|
Dear DBA,
I would appreciate had any Unix script to delete the old archive log files.
Thanks for the advance,
Michael Ma.
-- Author: Michael Ma INET: Michael.Ma_at_exodus.net 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-LReceived on Thu Jun 01 2000 - 09:46:07 CDT
![]() |
![]() |