#!/bin/ksh -p
# Author: Gil Standen
#
write_backup_files.ksh (subroutine to write the dynamically-generated
backup scripts)
#
# To implement on
production, take following steps:
# Change
"st2" to "spr" using :%s/st2/spr/gc
# Change
"ft2" to "fpr" using "%s/ft2/fpr/gc
#
# verify existence
of $ORACLE_HOME/pfcs"xx".env file before implementing this script on
a new
# environment.
# where
"xx" is [ pr, t2, d1, ... ]
##################################################################################################
[ "${DEBUG}" = "TRUE" ] &&
set -x
. ${ORACLE_HOME}/pfcst2.env
export
ORACLE_HOME=$1
export
ORACLE_SID=$2
export
ext1=$3
export
TMPFILE=$4
export
tsname=$5
export
lfname=$6
export sfname=$7
export
tstatus=$8
export
RF=$9
export dest=/mnt/pfcs/pfcst2/HOTBACKUP/backup/
export dest_prev=/mnt/pfcs/pfcst2/HOTBACKUP/backup2/
export
dest_files=/mnt/pfcs/pfcst2/HOTBACKUP/tablespace_copy_scripts/
if [ $tstatus = 'Tablespace altered.' ]
then
echo 'if [ -r '$dest'/'$sfname'.dbf.*.gz ]' >>
${TMPFILE}
echo 'then' >> ${TMPFILE}
echo 'mv '$dest'/'$sfname' '$dest_prev'/'$sfname'/.'
>> ${TMPFILE}
echo 'fi' >> ${TMPFILE}
echo 'cat '$lfname' | gzip -c >
'$dest'/'$sfname'.dbf.'$ext1'.gz' >> ${TMPFILE}
else
echo $tstatus > $RF
fi
exit