#!/bin/sh # # $DBA/delarch # # Deletes archived redo log files which have been previously backed up # # Requires ORACLE_SID to be defined # # Parameters: # $1 = Database backup mode; One of "COLD" or "HOT". # $2 = Start of archive log destination (ARCHSTART) # $3 = End of archive log destination (ARCHEND) # # Last Change 02/21/97 by Brian Lomasky # if [ "$1" = "" ] then echo "Error - delarch requires COLD or HOT to be specified in \$1\007" mailto "delarch error - \$1 is not specified." exit 2 fi if [ "$ORACLE_SID" = "" ] then echo "Error - delarch requires ORACLE_SID to be defined\007" mailto "delarch error - ORACLE_SID is not defined." exit 2 fi if [ "$2" = "" ] then echo "Error - delarch requires archive log start to be specified" \ " in \$2\007" mailto "delarch error - \$2 is not specified." exit 2 else ARCHSTART=$2 fi if [ "$3" = "" ] then echo "Error - delarch requires archive log end to be specified" \ " in \$3\007" mailto "delarch error - \$3 is not specified." exit 2 else ARCHEND=$3 fi echo "Deleting obsolete archived redo logs..." if [ "$1" != "HOT" ] then # # Startup the $ORACLE_SID database in exclusive mode # echo " Starting database $ORACLE_SID in exclusive mode..." dbostart $ORACLE_SID exclusive exit_status=$? if [ $exit_status -ne 0 ] then mailto \ "delarch error - Unexpected error $exit_status from dbostart for $ORACLE_SID" fi fi # Calculate the maximum redo log sequence number that is not current maxseq=`sqlplus -s / < 'CURRENT'; exit XXX` echo " Maximum non-current redo log sequence number is $maxseq" logfmt=`sqlplus -s / < /dev/null 2>&1 if [ ${?} -eq 0 ] then cmd=nawk else cmd=awk fi find ${ARCHSTART}*${ARCHEND} -exec $DBA/delarch2 {} $maxseq $logfmt $cmd \;