Shell Script Backup oracle offline and dump for Peplesoft with AIX machine

** Myself
############
# ENV
export orauser=oracle
export pepleuser=psft811
export pepleexe=/u01/PeopleSoft/E811/system/bin32
export oraexe=/u01/oracle/product/9.2.0/bin
export tape_dev=/dev/rmt0
export vg_back=datavg
export blog=/u01/backup.log
############ Main program ###########
echo "-------------------------------------------------" >> $blog
echo "Start backup process" >> $blog
echo ""
date >> $blog
#### Shutdown Application############
echo "Shutdown PeopleSoft Application" >> $blog
echo ""
su - ${pepleuser} -c "${pepleexe}/EndOneWorld.sh" >> $blog
#### Delete message queses ############
echo "Delete message queses of PeopleSoft" >> $blog
echo ""
su - ${pepleuser} -c "${pepleexe}/rmics.sh" >> $blog
#### Stop listener database###############
echo "Stop listener database" >> $blog
echo ""
su - ${orauser} -c "${oraexe}/lsnrctl stop" >> $blog
#### Shutdown database ###############
echo "Shutdown database " >> $blog
echo ""
su - ${orauser} -c "${oraexe}/sqlplus /nolog" << EOF  >> $blog
connect / as sysdba
shutdown immediate
exit
EOF
#### Backup all database files in vg############
echo " Backup all database files by Savevg command" >> $blog
echo ""
savevg -e -f ${tape_dev} -i  ${vg_back} >> $blog
#### start listener database###############
echo "Start listener database" >> $blog
echo ""
su - ${orauser} -c "${oraexe}/lsnrctl start" >> $blog
sleep 3
#### Start database###############
echo "Start database" >> $blog
echo ""
su - ${orauser} -c "${oraexe}/sqlplus /nolog" << EOF >> $blog
connect / as sysdba
startup
exit
EOF
#### Start Application############
echo "Start PeopleSoft Application" >> $blog
echo ""
sleep 60
su - ${pepleuser} -c "${pepleexe}/RunOneWorld.sh" >> $blog
#### Export dump file ############
echo "Export dump file " >> $blog
echo ""
su - ${orauser} -c "${oraexe}/exp userid=prodctl/prodctl file='/u01/backup_dump/prodctl.dmp" >> $blog
su - ${orauser} -c "${oraexe}/exp userid=proddta/proddta file='/u01/backup_dump/proddta.dmp" >> $blog
echo "Backup Finish" >> $blog
echo "-------------------------------------------------" >> $blog

0 comments:

Loading