Pavan DBA's Blog

The DBA Knowledge Store

Posts Tagged ‘script for deleting applied archive on standby database on unix OS’

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

Posted in Dataguard, Scripts | Tagged: , | Leave a Comment »

 
%d bloggers like this: