oracle@dbtestserver $ cat /export/home/oracle/scripts/rman_ORCL.ksh
#!/bin/ksh
mailTo="dba_group@oratech.com"
logdir=/rman_bkp/oradata/ORCL/logs
#set the oracle environment
ORACLE_HOME=/ora_home/oradata/product/11.2.0.3/dbhome_1
ORACLE_SID=ORCL
export ORACLE_HOME
export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export PATH
#check if user is oracle
USER=`/usr/ucb/whoami`
if [ $USER != "oracle" ]
then
echo "ERROR: This script must be run as the oracle user"
echo "Exiting... `date`"
exit 1
fi
# --------------------------------------------------------------------------------
# backup now
# --------------------------------------------------------------------------------
rman target / catalog rman11g/rman11g@rmandnpd<< EOF >>$logdir/"rman_ORCL_full_`date +%d_%m_%Y`".log
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE = 2G;
sql 'alter system switch logfile';
run
{
allocate channel dsk1 type disk format '/rman_bkp/oradata/ORCL/%U';
allocate channel dsk2 type disk format '/rman_bkp/oradata/ORCL/%U';
backup database;
crosscheck archivelog all;
backup archivelog all delete input;
}
exit
EOF
/bin/find /rman_bkp/oradata/ORCL/ \*_1 -mtime +1 -exec rm {} \;
AS_OF=`date +%d_%m_%Y`
#mail $mailTo <"$logdir/rman_ORCL_full_`date +%d_%m_%Y`".log
mail ${mailTo} <<EOF
From:dbtestserver
To: dba_ora@oratech.com
Subject: ORCL Delivery INFO - Full RMAN Backup of ORCL db
`cat $logdir/rman_ORCL_full_${AS_OF}.log`
EOF
#!/bin/ksh
mailTo="dba_group@oratech.com"
logdir=/rman_bkp/oradata/ORCL/logs
#set the oracle environment
ORACLE_HOME=/ora_home/oradata/product/11.2.0.3/dbhome_1
ORACLE_SID=ORCL
export ORACLE_HOME
export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export PATH
#check if user is oracle
USER=`/usr/ucb/whoami`
if [ $USER != "oracle" ]
then
echo "ERROR: This script must be run as the oracle user"
echo "Exiting... `date`"
exit 1
fi
# --------------------------------------------------------------------------------
# backup now
# --------------------------------------------------------------------------------
rman target / catalog rman11g/rman11g@rmandnpd<< EOF >>$logdir/"rman_ORCL_full_`date +%d_%m_%Y`".log
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE = 2G;
sql 'alter system switch logfile';
run
{
allocate channel dsk1 type disk format '/rman_bkp/oradata/ORCL/%U';
allocate channel dsk2 type disk format '/rman_bkp/oradata/ORCL/%U';
backup database;
crosscheck archivelog all;
backup archivelog all delete input;
}
exit
EOF
/bin/find /rman_bkp/oradata/ORCL/ \*_1 -mtime +1 -exec rm {} \;
AS_OF=`date +%d_%m_%Y`
#mail $mailTo <"$logdir/rman_ORCL_full_`date +%d_%m_%Y`".log
mail ${mailTo} <<EOF
From:dbtestserver
To: dba_ora@oratech.com
Subject: ORCL Delivery INFO - Full RMAN Backup of ORCL db
`cat $logdir/rman_ORCL_full_${AS_OF}.log`
EOF
No comments:
Post a Comment