Will,

One way to answer your question is with "bpimagelist -media"; read the man
page for an explanation of the options.  If you provide the appropriate
qualifiers (client, dates, etc.) to focus the search, you find what media
would potentially be needed for the restore.  Ed's advice is better in that
kicking off the restore is likely to require fewer tapes as the restore may
specify down to files while bpimagelist doesn't allow that.

Ed omits a few of the details on the mechanics of watching for jobs needing
media, suspending and alerting.  The attached script shows a means of doing
that.  It should be seasoned to taste and then called from cron on 5 minute
intervals.

--Larry

On Mon, Nov 23, 2009 at 7:00 PM, Ed Wilts <ewi...@ewilts.org> wrote:

> On Mon, Nov 23, 2009 at 4:43 PM, Will Tucker <wtuc...@manh.com> wrote:
>
>>
>> I'm curious as to what everyone is using for the "Images on Media"
>> process?  If you need to do a restore outside of the "tape reports" window,
>> how do you determine which tapes are requested from Iron Mountain or
>> whatever off-site provider you use to perform the restores?
>>
>
> Our standard way is to kick off a restore, let it determine which tapes are
> needed, suspend the restore, call back tapes, and then resume the restore.
> This usually works well but you have to be careful if there any images on
> DSSUs that could get deleted between the initial restore and when it's
> resumed.
>
> There are ways to preview the restore to tell you which tapes are needed
> but why bother with a preview - you either need the restore or you don't.
>
> .../Ed
>
> Ed Wilts, RHCE, BCFP, BCSD, SCSP, SCSE
> ewi...@ewilts.org
>
>
> _______________________________________________
> Veritas-bu maillist  -  Veritas-bu@mailman.eng.auburn.edu
> http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
>
>


-- 
Larry Fahnoe, Fahnoe Technology Consulting, fah...@fahnoetech.com
952/925-0744      Minneapolis, Minnesota       www.FahnoeTech.com
#!/usr/bin/sh

PATH=$PATH:/usr/local/bin:/usr/openv/netbackup/bin/admincmd:/usr/openv/volmgr/bin
addr=someone.who.ca...@yourcompany.com
TEMP1=/var/tmp/check-pending-1.$$
TEMP2=/var/tmp/check-pending-2.$$
TEMP3=/var/tmp/check-pending-3.$$
TRYLOGS=/usr/openv/netbackup/db/jobs/trylogs

cleanup() {
    [ -f $TEMP1 ] && rm -f $TEMP1
    [ -f $TEMP2 ] && rm -f $TEMP2
    [ -f $TEMP3 ] && rm -f $TEMP3
}

trap cleanup TERM EXIT

# Get current time, figure out hi and low minutes to test against
# (assumes this is run on 5 minute intervals)
H=`date +'%H'`
M=`date +'%M'`
if [ $M -eq 0 ]
then
    M=60
    H=`expr $H - 1`
    [ $H -eq -1 ] && H=23
fi
lo=`expr $M - 6`
hi=`expr $M + 1`

# Check for pending tape requests
vmoprcmd -dp pr > $TEMP1

#                                 PENDING REQUESTS
#
#ReqId      User    RecMID  ExtMID  Density  Mode    Time   Barcode   VolGroup
#383399                     003591  hcart    Read    13:27  003591    
OFFSITE_LTO

# For each request, extract the time and barcode, then see if it
# happened within the last window.  Then check the active or suspended
# restore jobs to see what media is required.  If there are tapes that
# are off-site, report which vault they live in along with any other
# tapes required for the restore jobs.

perl -ne 'if (m|(\d+:\d+\s+\d+)|) {print "$1\n";}' $TEMP1 | while read time 
media
do
  h=`echo $time | awk -F: '{ print $1 }'`
  m=`echo $time | awk -F: '{ print $2 }'`
  if [ $m -eq 0 ]
  then
      m=60
      h=`expr $h - 1`
      [ $h -eq -1 ] && h=23
  fi
  if [ $h -eq $H ]
  then
    if [ $m -gt $lo -a $m -lt $hi ]
    then
      echo "Current restore jobs:" > $TEMP2
      bpdbjobs | egrep -i 'restore.*(active|suspended)' | tee -a $TEMP2 | awk 
'{print $1}' | while read jobID
      do
        awk '/MEDIA_ID_NEEDED/ {print $NF, '$jobID'}' $TRYLOGS/${jobID}.t
      done | sort | uniq > $TEMP1

      echo "" >> $TEMP2
      echo "Tapes needed for restores:" >> $TEMP2
      cat $TEMP1 | while read media jobID
      do
        if vmquery -m $media | grep -i 'robot type:.*none' > /dev/null 2>&1
        then
            touch $TEMP3
            vault=`vmquery -m $media | grep -i 'vault name:' | awk '{print 
$NF}'`
            echo $media \(job $jobID\) is off-site at $vault >> $TEMP2
            echo Suspending job $jobID >> $TEMP2
            bpdbjobs -suspend $jobID
        else
            echo $media \(job $jobID\) >> $TEMP2
        fi
      done

      if [ -f $TEMP3 ]
      then
        mailx -r $ADDR -s "NetBackup vault tapes needed" $ADDR < $TEMP2
      fi
    fi
  fi
done
_______________________________________________
Veritas-bu maillist  -  Veritas-bu@mailman.eng.auburn.edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu

Reply via email to