Pavan DBA's Blog

The DBA Knowledge Store

script for deleting applied archive on standby database on unix OS

Posted by Pavan DBA on March 26, 2012


#############################################################

unix script for deleting applied archives in standby database

#############################################################

#!/usr/bin/ksh

ARCH_DIR=/archive/orcl

 

#take the log number to be applied

LogNo=`tail -30000 /oracle/app/oracle/product/10.2.0/admin/orcl/bdump/alert* | grep “Media Recovery Log” | cut -d ” ” -f 4 | cut -d “_” -f 5 | tail -1 `

echo “Oracle applied LogNo is $LogNo”

 

#extract 10

let SecLogNo=${LogNo}-10

echo “new backlog log No: $SecLogNo”

 

#delete small numbers from this in arch dir

cd $ARCH_DIR

for i in `ls *.arc`

do

 

Newi=`echo $i | cut -d “_” -f 4`

if [ $Newi -lt $SecLogNo ] ; then

echo “$i to be deleted…”

rm $i

fi

done

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: