Starting RMAN Backup Based on Archive File Systemn
by Avnish Rastogin
n
Often when DBAs do export/import to load data from one database to another database, it gerenartes archive logs at very high pace and fills up archive file system in couple of hours. Below script will help DBA in scheduling RMAN backup based on file system usage. Please change the location of logfile, cmdfile and RMAN catalog user/password before using this script.n
n
##########################################################################n
# Description: Purpose of this script is to kick off RMAN backup for archive logs when archive filen
# n
##########################################################################n
#!/bin/ksh -xn
n
if [ $# != 1 ]n
thenn
echo ‘Usage: feeSpace.ksh %Used’ 1>&2n
exit 1n
fin
n
FSUsed=$1n
n
#GET LOG ARCHIVE DEST FROM V$PARAMETERn
n
LogArchiveDest=`$ORACLE_HOME/bin/sqlplus -s ‘/as sysdba’
exit;n
!`n
n
#Define Command Variables used by RMANn
n
MSGLOG=/tmp/arch_RMAN.logn
CMDFILE=/tmp/arch_RMAN.rcvn
RMANCatalog=user/passwd@service.orgn
n
set `df -P $LogArchiveDest |grep -v Filesystem`n
PercentUsed=`echo $5|cut -f1 -d ‘%’`n
FS=$6n
n
if [ ‘$PercentUsed’ -gt ‘$FSUsed’ ]n
thenn
$ORACLE_HOME/bin/arman target / catalog $RMANCatalog cmdfile $CMDFILE msglog $MSGLOGn
fin
n
n
Rman Script for kicking off archive backups in Oracle 9In
n
run {n
BACKUP ARCHIVELOG ALL DELETE INPUTn
FILESPERSET 6n
FORMAT ‘%d_%D%M%Y.%s’;n
}n
n
Rman Script for kicking off archive backups in Oracle 8In
n
run {n
allocate channel t1 type ‘SBT_TAPE’;n
#backup all archive logsn
sql ‘alter system archive log current’;n
backupn
filesperset 5n
format ‘al_%s_%p_%t’n
(archivelog all delete input);n
sql ‘alter system archive log current’;n
sql ‘alter database backup controlfile to trace’;n
resync catalog;n
}
Leave a Reply