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

#

# aiswitch2.sh

#

# This shell performs switches the after image file, copies it to the after

# image directory.

#

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

 

while :

do

??? # Get the oldest full AI file

 

AIFILE=`$DLC/bin/rfutil $DBDIR/$DBNAME -C aimage extent full|/usr/bin/grep $DBNAME`

if [ $AIFILE ]

then

# Copy the AI file to the replication direcotry

TS=`/usr/bin/date "+%y%m%d%H%M%S"`

gzip -c1 $AIFILE > $AI_TO_DR/${DBNAME}.${TS}.gz

if [ $? != 0 ]

then

echo $RUNDATE $DBDIR $DBNAME "AIERROR. Could not zip the full AI extent $AIFILE to $AI_TO_DR/${DBNAME}.${TS}.gz"

exit 2

fi

 

# Mark the full AI extent as empty

$DLC/bin/rfutil $DBDIR/$DBNAME -C aimage extent empty > /dev/null

if [ $? != 0 ]

then

echo $RUNDATE $DBDIR $DBNAME "AIERROR.? Could not mark the AI extent as empty"

exit 1

fi

sleep 1

else

exit 0

fi

done