$! NIGHTLY_BACKUP.COM $! 15-Aug-91 L Baldwin $! $! Command procedure to perform full on-line Image backups $! $! Parameters: $! $! P1[required] - Backup set to process (e.g. S01, S02, etc.) $! $! P2[required] - Scheduled backup date, "" for current date $! $! P3[optional] - "PRE" to just verify that correct tape is loaded $! $ ON WARNING THEN GOTO PROCESS_ERROR $ @TASM$COM:TASM_MENUSYM ! Get global symbols $ @TASM$COM:BCK_ERRORS $! $! Parameters Passed in $! $ bckset = p1 ! Selected backup set $ date = p2 ! Desired backup date $ if date .eqs. "" then date = f$time() $ options = f$edit(p3,"UPCASE") ! If "PRE" then do tape check only $! $ set verify $ @TASM$COM:BCK_SETS.COM 'bckset' ! Get backup parameters $ @TASM$COM:BCK_CALC_LABEL 'bckset' 'date' ! Global symbols "LABEL" returned $ if label .eqs. "" then exit ! No backup scheduled $ GOSUB CHECK_LABEL ! See if tape loaded $ if options .eqs. "PRE" then exit $! $! Do Backup $! $ n = 1 $NEXT_DEVICE: $ if n .gt. bck_count then goto DONE ! No more device $ device = f$element(n,"/",bck_devices) $ saveset = f$element(n,"/",bck_savesets) $ backup/rewind/image/ignore=interlock/record/label='label' - /list=TASM$BACKUPS:'label'_'bck_saveset'.lis - 'device' 'bck_tape''saveset''bck_outqual' $ n = n + 1 ! Next device $ goto NEXT_DEVICE $CHECK_LABEL: $! $! Try to Mount it $! $MOUNT: $ status = f$getdvi("''bck_tape'","ALL") ! Make sure not allocated $ if status .eqs. "FALSE" then goto DO_MOUNT $ request/reply/to=TAPES - "''bck_tape' is allocated by another user. Use REPLY/TO when available." $ GOTO MOUNT $DO_MOUNT: $ set noon $ mount/noassist 'bck_tape' 'bck_label' $ saved_sts = $status $ saved_sev = $severity $ set on $CHECK_ERROR: $ sh sym saved_sts $ if saved_sts .ne. incorrect_label then goto 10$ $ mount/noassist/override=id 'bck_tape' ! Override label $ vol = f$getdvi("''bck_tape'","volnam") ! Find what is mounted $ dismount/unload 'bck_tape' $ request/reply/to=TAPES - ! Tell oper a problem "Wrong volume mounted (''vol'), mount ''bck_label' in ''bck_tape' and use REPLY/TO." $ goto MOUNT $! $10$: $ if saved_sts .le. 1 then goto TAPE_OK $ if saved_sts .ne. not_loaded then goto 20$ $ request/reply/to=TAPES - ! No tape loaded "No tape mounted, please mount ''bck_label' in ''bck_tape' and use REPLY/TO." $ goto MOUNT $! $20$: $ if saved_sts .ne. not_initialized then exit $status $! $ request/reply/to=TAPES - ! Tape not initialized "Tape is not initialized, issue a REPLY/TO to force initialization." $ on error then goto CHECK_ERROR $ init 'bck_tape' 'bck_label' $ goto MOUNT $! $! Tape with correct label is in drive, keep it there $! $TAPE_OK: $ if options .nes. "PRE" then goto NO_DISMNT $ request/to=TAPES - "Tape: ''bck_label' is loaded and ready for tonights backup." $ dismount/nounload 'bck_tape' $ return $NO_DISMNT: $ request/to=TAPES "Tape: ''bck_label' is loaded, BCK_NIGHTLY proceeding." $ dismount/nounload 'bck_tape' ! dismount and remount /FOR for BACKUP $ mount/foreign 'bck_tape' $ show time $ return $PROCESS_ERROR: $ saved_sts = $STATUS $ say "An error occurred in BCK_NIGHTLY." $ exit saved_sts ! Exit and return status $DONE: $ saved_sts = $STATUS $ write sys$output f$message($status) $ dismount/unload 'bck_tape' $! $! Submit job to check the log file of this job for errors $! $ SUBMIT/NOPRINT TASM$COM:BCK_CHECK- /PARAM=("TASM$BACKUPS:BCK_NIGHTLY_''bckset'.LOG","''DATE'") $ exit saved_sts $! Modification History: $! --------------------- $! 06-Sep-91 llb - remove ora_backup flag/do a log file switch always $! 28-Aug-91 llb - Fix ora_backup flag bugs, reenable D01 backups $! 27-Aug-91 llb - Add backups for Oracle database disks dua2,3,4,5 $! 11-Nov-92 llb $! 06-Feb-93 llb - Add auto resubmit $! 11-Jun-93 llb - Move pre-processing into main code