Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking Netbackup DB Backup Attribues via command line

Status
Not open for further replies.

johngiggs

Technical User
Joined
Oct 30, 2002
Messages
492
Location
US
I would like to write a script to check the current DB backup tape and compare it with the current inventory. I would like to check to see if the DB backup tape is the same tape number as the tape in slot 8. This would be a simple task for me as I should be able to handle the scripting portion, however I am new to NetBackup and I do not know the commands which I should execute to get the necessary information. Ex. If the DB backup tape is defined to be 500001 and the tape in slot 8 is 500002, I would like to see output on the screen saying "Please check the DB backup tape number." or something similar to that. Any help would be greatly appreciated.

Thanks,

John
 
Here is a script I have that was written by an Engineer at Veritas.

#! /bin/ksh

# This script will create a NetBackup database copy onto a specified tape
# Creator of this script is unknown, but the person I received it
# from is Bob Bakh with Veritas Software (that doesn't mean its supported)
# - David Chapa

NB=/usr/openv/netbackup
NB_PATH=$NB/bin
VM_PATH=/usr/openv/volmgr/bin
ADM_PATH=$NB_PATH/admincmd
POOL=NetBackup_Alt
MOUNT_LOC=/tmp/nb_mount
LOG=$NB/user_def/nbdb.log
OPS_RPT=$NB/user_def/ops_report
DATE=`date +%D`

echo "Backing up NetBackup database to tape...."
# Get a list of all tapes in $POOL and filter only those that are in the
robot (TLD)
# From this list find the tape with the least amounts of mounts
MEDIA_ID=`$VM_PATH/vmquery -bx -pn $POOL 2> /dev/null | grep TLD | awk '
BEGIN { MOUNTS=1000000}
{
if ( $9 < MOUNTS )
{ MEDIAID=$1
MOUNTS=$9
}
}
END {print MEDIAID} '`

# Mount the tape
$VM_PATH/tpreq -ev $MEDIA_ID -d dlt -p $POOL $MOUNT_LOC
if [ $? -ne 0 ] ; then
echo &quot;Tape $MEDIA_ID failed to mount, bpbackupdb cancelled on $DATE&quot; >>
$LOG
echo &quot;Tape failed to mount. Contact Storage Management.&quot; >> $OPS_RPT
echo &quot;Tape failed to mount. Contact Storage Management.&quot;
echo &quot;Press Enter to exit&quot;
read ans
exit 1
fi

# Create the database backup
$ADM_PATH/bpbackupdb -v -tpath $MOUNT_LOC
STATUS=$?
if [ $STATUS -ne 0 ] ; then
$VM_PATH/tpunmount $MOUNT_LOC
echo &quot;bpbackupdb failed with error $STATUS on $DATE&quot; >> $LOG
echo &quot;NetBackup database backup failed. Contact Storage Management.&quot; >>
$OPS_RPT
echo &quot;NetBackup database backup failed. Contact Storage Management.&quot;
echo &quot;Press Enter to exit&quot;
read ans
exit 2
fi

# Unmount the tape
$VM_PATH/tpunmount $MOUNT_LOC

# Eject the tape
integer STATUS=1
while [ $STATUS -ne 0 ]
do
sleep 20
$VM_PATH/vmchange -res -m $MEDIA_ID -mt dlt -rt none -rc1 0 -rc2 0 -e 2>
/dev/null
STATUS=$?
if [ $STATUS -eq 221 ] ; then
while true
do
echo &quot;Robot Mail slot is full.&quot;
echo &quot;Please empty the robot CAP and press return when robot CAP is
empty&quot;
read ans
$VM_PATH/vmchange -res -m $MEDIA_ID -mt dlt -rt none -rc1 0 -rc2 0 -e 2>
/dev/null
if [ $? -ne 221 ] ; then
break
fi
done
fi
done

echo &quot;NetBackup database backed up successfully to tape $MEDIA_ID on $DATE&quot;
>> $LOG
echo &quot;NetBackup database backed up successfully to tape $MEDIA_ID on $DATE&quot;
echo &quot;\n *** Media ID $MEDIA_ID has been ejected - send offsite for 1 week
***&quot;
echo &quot;\n *** Media ID $MEDIA_ID has been ejected - send offsite for 1 week
***&quot; >> $OPS_RPT
echo &quot;\n NetBackup database backup ended&quot;
read ans
exit 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top