Veritas-bu

[Veritas-bu] Tape Images Expiring & Scratch Pool

2003-05-09 14:25:22
Subject: [Veritas-bu] Tape Images Expiring & Scratch Pool
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Fri, 9 May 2003 12:25:22 -0600
NB4.5 FP3 (and only this precise version & up) will automatically return
expired tapes to the scratch pool.  If you want to do it for lower version
it can be scripted.  

Here's mine - You can adapt as necessary.  I run mine twice daily via cron.

-M

#!/bin/ksh
##Auto_ScratchPool
## This script is used to identify all tapes which are available for
## use (all expired images) but are not in the "ScratchPool" and change
## them to be in the Scratchpool. This should increase tape availability
## for all Classes of backups.
#
# Mark Donaldson - Nov 11, 1999 - Created
# MDD 3/14/2001 - Remove need to have tape in robot to set back to
Scratchpool
# Should be able to expire anywhere it is located. Will track
# Offsite & Cabinet stuff with Volume Groups.
# MDD 8/27/2002 - Removed logging stuff and neatened the code a little
# MDD 12/01/2002 - Confirmed OK for multilibrary - added mailed report
# 12/17/2002 - Added bpexpdate -deassignempty

MAILADDR=YOU AT YOURDOMAIN DOT COM

export PATH=$PATH:/usr/openv/volmgr/bin:/usr/openv/netbackup/bin/admincmd
LOGFILE=/usr/openv/netbackup/logs/`basename $0`.log
exec 1>$LOGFILE 2>&1
echo "`basename $0` started at `date`."

# Note: vmquery col 1 is tape number
# col 3 is tape type
# col 9 is slot number
# col 12 is poolname
# col 20 is "assigned" date
# col 28 is status code (0=regular backups, 1=NB DB, 2=HSM)

#Now lookup scratchpool pool number.
SPname=`vmpool -listscratch | tail -1`
SPnum=`vmpool -listall | \
       awk -F: '$1=="pool number" {pn=$2}
                $1=="pool name" && $2~/^ *'$SPname'$/ {print pn}'`

bpexpdate -deassignempty -force

tapelist=`vmquery -a -w | awk '$3 !~ /CLN/ && \
          $20 ~ /^00/ && \
          $12 != "'$SPname'" && \
          $28 == 0 {print $1}' `

count=0
for eachtape in $tapelist
do
  #Tape available for reassignment to scratchpool.
  echo "$count: Changing $eachtape to $SPname pool."
  vmchange -p $SPnum -m $eachtape
  count=`expr $count + 1`
done
if [ $count -gt 0 ]
then
  echo "mailing output to $MAILADDR."
  echo $tapelist | \
  mailx -s "`basename $0` converted $count tapes to $SPname pool" $MAILADDR
fi
exit


-----Original Message-----
From: James K. Wade [mailto:james AT lim DOT com]
Sent: Friday, May 02, 2003 12:38 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Tape Images Expiring & Scratch Pool


Howdy All,

With Veritas NetBackup, Is there a way that 
when tape images expire on a  tape to 
automatically have the tape go to the scratch 
pool to be utilized by other jobs?

Thanks..James

<Prev in Thread] Current Thread [Next in Thread>