

Listing 3

--------------------------------------------------------------------------------
#script name: flashrecreate.sh
#
# written For: R3BNKORA AIX node
# Date      : December 2005
# Created By: Khurram Shiraz
# Purpose	: Shell Script for creating flash snapshots and making them #available on AIX so that TSM client can backup flashed filesystems to TSM Server.
-----------------------------------------------------------------------
#!/bin/ksh
TSTFL="/scripts/lockfile"
if [ ! -f $TSTFL ];
then
echo Please ensure that FlashCopy Pairs are already removed before this script execution
echo It seems that they are still in place 
echo therefore exiting!!!!
exit 1
else
echo Putting Oracle into hot backup Mode
echo please wait ............................
#
su - bnkora -c "sqlplus /nolog < /scripts/begin_backup.sql"
sleep 10

chfs -a freeze=60 /oracle/data1
chfs –a freeze=60 /oracle/data2
chfs –a freeze=60 /oracle/data3
chfs –a freeze=60 /oracle/data4
chfs –a freeze=60 /oracle/archivelogs

# Execution of DScli commands

/opt/ibm/dscli/dscli mkflash -dev IBM.2107-7520431 -nocp  1100:1105
/opt/ibm/dscli/dscli mkflash -dev IBM.2107-7520431 -nocp  1101:1106
/opt/ibm/dscli/dscli mkflash -dev IBM.2107-7520431 -nocp  1102:1104


chfs –a freeze=off  /oracle/data1
chfs –a freeze=off  /oracle/data2
chfs –a freeze=off  /oracle/data3
chfs –a freeze=off  /oracle/data4
chfs –a freeze=off /oracle/archivelogs

# Putting Oracle back to normal Mode
su - bnkora -c "sqlplus /nolog < /scripts/end_backup.sql"

# Now working for Flashed Data.......
#
cfgmgr

# Starting preparation of LVM & VGs for mounting of filesystems

chdev -l vpath0 -a pv=clear
chdev -l vpath1 -a pv=clear
chdev -l vpath2 -a pv=clear

recreatevg -y flashvg1 -Y flash –L /flash vpath0
recreatevg -y flashvg2 -Y flash –L /flash vpath1
recreatevg -y flashvg3 -Y flash –L /flash vpath2


echo   ……. now running fsck & mounting fs


fsck -y  /flash/oracle/data1
mount /flash/oracle/data1
fsck -y /flash/oracle/data2
mount /flash/oracle/data2
fsck -y /flash/oracle/data3
mount /flash/oracle/data4
fsck -y /flash/oracle/data4
mount /flash/oracle/data3
fsck –y /flash/oracle/archivelogs
mount /flash/oracle/archivelogs

cd /scripts
rm lockfile
exit 0
fi

