Title: Automating a Cold Backup When Running Peoplesoft HRMS
Author: Jyothi Eppalapalli, a Database Adminstrator for the Dallas County Hospital District in Dallas, Texas. If you are running Peoplesoft HRMS, the process scheduler and Tuxedo server have to be started and shut down only from the PSOFT account. Even the ?root? user cannot perform these operations with the given file access permissions. Instead of playing with the file access permissions, I have come up with the following simple method to shut down the process scheduler and Tuxedo server, perform a cold backup of the Oracle database, and start up the database, the process scheduler, and Tuxedo.Source/Text/Comments
Step 1
Log into the PSOFT account, create the following script and place it in PSOFT?s crontab.
# COLDSHUT
#
# Set up the environmental variables, run tux.env and psconfig.sh also
#
ORACLE_SID=$1; export ORACLE_SID # Parameter #1
ORACLE_HOME=/disk01/app/oracle/product/7.3.2; export ORACLE_HOME
PATH=${PATH}:/disk01/app/oracle/product/7.3.2/bin:/usr/lbin:/home/psofttrn/hr600/bin
. /disk07/tuxedo/tux.env
. /home/psofttrn/hr600/psconfig.sh
#
# Pick a directory where ORACLE and PSOFT both ?write? access to store the log
#
coldlog=/coldbackup.$ORACLE_SID.log; export coldlog
echo "Beginning Cold Backup `date +%m%d%y`" > $coldlog
cd /home/psofttrn/hr600/bin
echo "About to shutdown the process scheduler ......" >> $coldlog
echo "================================================\n\n" >> $coldlog
PSRUN PTPUPRCS ORACLE/HRTRN/USERID/PASSWORD/-kPSUNX >> $coldlog
#
echo "\n\n\nAbout to shutdown the Tuxedo Server ......" >> $coldlog
echo "================================================\n\n" >> $coldlog
tuxshuthrtrn 2>> $coldlog
Step 2
Log into the ORACLE account, create the following script and place it in the crontab.
Important: Time the script a few minutes after the above script.
#! /bin/ksh
#
# Set up the environmental variables
#
ORACLE_SID=$1; export ORACLE_SID # Parameter 1
bkupdir=$2; export bkupdir # Parameter 2
ORACLE_HOME=/disk01/app/oracle/product/7.3.2; export ORACLE_HOME
PATH=${PATH}:$ORACLE_HOME/bin:/usr/lbin; export PATH
#
# Pick the same backup log as in the above script, and make sure to append to the file
#
coldlog=/coldbackup.$ORACLE_SID.log; export coldlog
coldlog2=/coldstartup.$ORACLE_SID.log; export coldlog2
#
echo "\n\nGoing to shutdown the $ORACLE_SID database ........" >> $coldlog
echo "===========================================================\n" >> $coldlog
#
svrmgrl << EOF2 >> $coldlog
connect internal
shutdown immediate
exit
EOF2
#
cp /disk*/oradata/$ORACLE_SID/* $bkupdir
#
# I always label the files, with the pattern - filename.coldbkup.database.mmdd for clarity
#
templist=/disk01/app/oracle/local/scripts/templist; export templist
dt=`date +%m%d`; export dt
# Above 2 variables store the temporary list of files and the date format to append to file name
ls $bkupdir > $templist
echo "Proceeding to label the cold backup files ........." >> $coldlog
#
cat $templist | while read fname
do
mv $bkupdir/$fname $bkupdir/$fname.coldbkup.$ORACLE_SID.$dt
echo "Copied $fname to =======> $fname.coldbkup.$ORACLE_SID.$dt"
done
#
#
echo "\n\nFINISHED COLD BACKUP OF $ORACLE_SID" >> $coldlog
echo "===========================================" >> $coldlog
#
# Immediately begin the startup procedure
#
echo "Beginning Startup procedure `date +%m%d%y` ......." > $coldlog2
echo "============================================================" >> $coldlog2
#
svrmgrl << EOF3 >> $coldlog2
connect internal
startup
exit
EOF3
#
Step 3
Log into the PSOFT account, create this second script and place it in the crontab
Important: Allow sufficient time for the above ORACLE?s script to complete and time this accordingly
# COLDSTART
#
# Set up the environmental variables, run tux.env and psconfig.sh also
#
ORACLE_SID=$1; export ORACLE_SID # Parameter #1
ORACLE_HOME=/disk01/app/oracle/product/7.3.2; export ORACLE_HOME
#
PATH=${PATH}:/disk01/app/oracle/product/7.3.2/bin:/usr/lbin:/home/psofttrn/hr600/bin
#
. /disk07/tuxedo/tux.env
. /home/psofttrn/hr600/psconfig.sh
#
# Pick the SECOND log from ORACLE?s script and append to it
#
coldlog=/coldstartup.$ORACLE_SID.log; export coldlog
cd /home/psofttrn/hr600/bin
echo "About to startup the process scheduler ......" >> $coldlog
echo "================================================\n\n" >> $coldlog
pspt -start pspt_hrtrn.in >> $coldlog
echo "\n\n\nAbout to shutdown the Tuxedo Server ......" >> $coldlog
echo "================================================\n\n" >> $coldlog
tuxstarthrtrn >> $coldlog
#
# End
#