==>cat SOX_BACKUP.ksh
#!/usr/bin/ksh
# +————————————————————————
# | Usage : ./SOX_BACKUP.ksh
# | Description : Cold Backup of Database. Automatically starts/stop the DB.
# +————————————————————————
. /export/home/oracle/FLRSTB.env
sqlplus -s /nolog << EOF > /mnt/ORACLEBACKUP/files.log
connect / as sysdba
set term off
set feedback off;
set head off;
set pagesize 150
select name||’ /mnt/ORACLEBACKUP/FLRPRD’ from v$datafile;
exit;
EOF
cat /mnt/ORACLEBACKUP/files.log|grep -v “Connected.” > /mnt/ORACLEBACKUP/files.dat
. /export/home/oracle/FLRSTB.env
sqlplus /nolog << EOF >> /mnt/ORACLEBACKUP/backup.log
connect / as sysdba
shutdown immediate;
exit;
EOF
echo “Backup Copy Started at :- `date` ” >>/mnt/ORACLEBACKUP/backup.log
nohup ./firecp.sh files.dat
echo “Backup Copy Ended at :- `date` ” >>/mnt/ORACLEBACKUP/backup.log
. /export/home/oracle/FLRSTB.env
sqlplus /nolog << EOF >> /mnt/ORACLEBACKUP/backup.log
connect / as sysdba
startup nomount;
alter database mount standby database;
exit;
EOF
oracle@sunrise*FLRSTB-/mnt/ORACLEBACKUP
==>
==>cat firecp.sh
#!/bin/ksh
# +————————————————————————
# | Usage : firescp.sh
# | filename – Flat file containing the operands for cp cmd
# | Description : Submits concurrent cp commands based on number of workers
# +————————————————————————
let WORKERS=5
LOGFILE=/mnt/ORACLEBACKUP/copy_dbfiles.log
while read -u3 CMDLINE
do
SRC_FILE=`echo ${CMDLINE}|awk ‘{print $1}’`
DST_FILE=`echo ${CMDLINE}|awk ‘{print $2}’`
echo “Now copying ${SRC_FILE} to ${DST_FILE}”|tee -a ${LOGFILE}
nohup /usr/bin/cp -p ${SRC_FILE} ${DST_FILE} 1>>${LOGFILE} 2>&1 &
sleep 1
while [[ `ps -ef|grep -v grep|grep “cp -p”|wc -l` -ge ${WORKERS} ]]
do
sleep 10
done
done 3<$1
wait
echo “SOX Copy of FLRPRD database is done”|mailx -s “Copy process done for FLRPRD on sunrise” bnair@1800flowers.com