From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96076337821605.tru64-unix-managers.marc@archive.invalid> From: Randy Rodgers Date: Wed, 21 Aug 1996 20:00:05 +0000 To: tru64-unix-managers Subject: SUMMARY: NSR backup of AdvFs clones X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96076337821605 I got one response. I have not had a chance to test this out, but it = looks like it should work. I decided to go ahead & post this summary = because I know of at least one other person who is interested. I got the following script from Ryan R. Ziegler : #!/bin/sh # clone_backup # Backup SAP database using AdvFS clone sets # # The general strategy # 1) shutdown SAP to flush oracle buffers to the tablespace files # 2) make clone sets, cloneset mount points, mount the clonesets # 3) restart SAP # 4) backup the clone sets # 5) unmount clonesets, remove cloneset mount points, remove clonesets # # Note 1) clonesets are removed as soon as the dump of that cloneset has # completed # 2) The /clone directory must exist before running this thing. # 3) A 'saveindex' is done each time we do a backup. This allows = us # to rebuild the index from the latest tape in the event of = 'trouble'. # # Tunable parameters # SID - SID of SAP database in *upper* case # DIRS - list of directories to be backed up # REMOTE_INSTS - application server instances running on remote = hosts # CLONE - directory of cloneset mount points - should not have general = access # TAPE - tape drive to do backups # DUMP - dump command to do backups # 'unset PRINTER' to eliminate the default printing of 'saveindex' logs. unset PRINTER SID=3DC14 # # The list of directories to be backed up. # DIRS=3D"/oracle/${SID}" DIRS=3D"$DIRS /oracle/${SID}/sapdata1" DIRS=3D"$DIRS /oracle/${SID}/sapdata2" DIRS=3D"$DIRS /oracle/${SID}/sapdata3" DIRS=3D"$DIRS /oracle/${SID}/sapdata4" DIRS=3D"$DIRS /oracle/${SID}/sapdata5" DIRS=3D"$DIRS /oracle/${SID}/saparch" DIRS=3D"$DIRS /oracle/${SID}/sapreorg" DIRS=3D"$DIRS /oracle/${SID}/saplog1" DIRS=3D"$DIRS /oracle/${SID}/saplog2" DIRS=3D"$DIRS /sapmnt/${SID}" DIRS=3D"$DIRS /usr/sap/${SID}" DIRS=3D"$DIRS /usr/sap/trans" DIRS=3D"$DIRS /usr/local/bin" DIRS=3D"$DIRS /bdc" DIRS=3D"$DIRS /bdc_${SID}" REMOTE_INSTS=3D"" # # The /clone directory MUST exist before running this script. # The 'tape' must be the 'no-rewind' device. # CLONE=3D/clone TAPE=3D/dev/nrmt1h HOST=3D`hostname` # DUMP=3D"tar cvf ${TAPE}" # DUMP=3D"vdump -0 -DN -F 64 -f ${TAPE}" DUMP=3D"save -L -q -l full -s ${HOST}" PATH=3D/sbin:/usr/sbin:/usr/bin sid=3D`echo ${SID} | tr '[A-Z]' '[a-z]'` ###################################################################### # # # Procedures # # # ###################################################################### # get_file_set_mount_point procedure # return a list of mountpoint#domain#fileset for each directory in = ${DIRS} # filesets will show up in the list only once get_fileset_mount_points() { df ${DIRS} 2> /dev/null | grep '#' | awk '{print $6 "#" $1}' | \ grep -v "^${CLONE}" | sort | uniq } # clone procedure # clone a fileset, create a mount point in ${CLONE}, mount the clone set = there # Parameters: # $1 - directory mount point of fileset # $2 - domain fileset to be cloned is in # $3 - fileset to be cloned clone() { dir=3D$1 domain=3D$2 fileset=3D$3 echo Cloning ${fileset} in domain ${domain} mounting on = ${CLONE}${dir} clonefset ${domain} ${fileset} clone_${fileset} mkdir -p ${CLONE}${dir} 2> /dev/null mount -t advfs "${domain}#clone_${fileset}" ${CLONE}${dir} } # unclone procedure # unmount cloneset, destroy mount point in ${CLONE}, remove cloneset # Assumes current directory is ${CLONE}, so created mount point can be = removed # Parameters # $1 - directory mount point of fileset # $2 - domain cloned fileset is in # $3 - original fileset name whose clone is to be destroyed unclone() { dir=3D$1 domain=3D$2 fileset=3D$3 umount ${CLONE}${dir} [ $? =3D 0 ] && { rmdir -p .${dir} 2> /dev/null rmfset ${domain} clone_${fileset} echo Unmounted ${CLONE}${dir} removed cloneset = ${fileset} from domain ${domain} } } # dodump procedure # dump a directory to tape; # Assumes currect directory is ${CLONE}, will dump the relative path # Parameters: # $1 - directory to dump dodump() { dumpdir=3D$1 echo Dumping clone of ${dumpdir} at `date` ${DUMP} .${dumpdir} [ $? !=3D 0 ] && { echo "$0: Backup of ${dumpdir} failed!!" } } # stopdb procedure # stop the running SAP database stopdb() { echo Shutting down SAP instance ${SID} at `date` # # application shutdown stuff goes here. # } } # startdb procedure # start the SAP database running start_sap() { # # stuff to start the database goes here. # } } ###################################################################### # # # Begin work here # # # ###################################################################### #################### # 0) check to see if we are super user #################### cd / [ `whoami` !=3D "root" ] && { echo You must be user \"root\" to run $0 exit 1 } #################### # 1) Shutdown SAP #################### stopdb #################### # 2) create clone sets #################### echo Creating clone sets at `date` for fs in `get_fileset_mount_points` do clone `echo $fs | sed "s/#/ /g"` done #################### # 3) restart SAP, resume brarchive #################### start_sap & #################### # 4) do the backup, print statistics, remove the clone #################### cd ${CLONE} for fs in `get_fileset_mount_points` do dodump `echo $fs | sed "s/#.*$//"` du -ks ${CLONE}`echo $fs | sed "s/#.*$//"` unclone `echo $fs | sed "s/#/ /g"` done #################### # 5) remove remaining clones that may have been mount points #################### for fs in `get_fileset_mount_points | sort -k br` do unclone `echo $fs | sed "s/#/ /g"` done saveindex -l full -s ${HOST} echo Cloneset backups complete at `date` exit 0 [=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D [ Randy Rodgers [ rrodgers@ci.ft-wayne.in.us [ System Administrator [ Allen County/City of Fort Wayne [ Information Systems [ (219)449-7660 [=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D