Starting RMAN Backup Based on Archive File System
by Avnish Rastogi
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.
##########################################################################
# Description: Purpose of this script is to kick off RMAN backup for archive logs when archive file
#
##########################################################################
#!/bin/ksh -x
if [ $# != 1 ]
then
echo 'Usage: feeSpace.ksh %Used' 1>&2
exit 1
fi
FSUsed=$1
#GET LOG ARCHIVE DEST FROM V$PARAMETER
LogArchiveDest=`$ORACLE_HOME/bin/sqlplus -s '/as sysdba'
exit;
!`
#Define Command Variables used by RMAN
MSGLOG=/tmp/arch_RMAN.log
CMDFILE=/tmp/arch_RMAN.rcv
RMANCatalog=user/passwd@service.org
set `df -P $LogArchiveDest |grep -v Filesystem`
PercentUsed=`echo $5|cut -f1 -d '%'`
FS=$6
if [ '$PercentUsed' -gt '$FSUsed' ]
then
$ORACLE_HOME/bin/arman target / catalog $RMANCatalog cmdfile $CMDFILE msglog $MSGLOG
fi
Rman Script for kicking off archive backups in Oracle 9I
run {
BACKUP ARCHIVELOG ALL DELETE INPUT
FILESPERSET 6
FORMAT '%d_%D%M%Y.%s';
}
Rman Script for kicking off archive backups in Oracle 8I
run {
allocate channel t1 type 'SBT_TAPE';
#backup all archive logs
sql 'alter system archive log current';
backup
filesperset 5
format 'al_%s_%p_%t'
(archivelog all delete input);
sql 'alter system archive log current';
sql 'alter database backup controlfile to trace';
resync catalog;
}
No comments:
Post a Comment