This is a multi-part message in MIME format.
------=_NextPart_000_00B1_01C249D1.638D91D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
This was written to allow Vault users to re-create the Recovery Report for a
particular DUP session.
You can easily modify it for your environment.
in my find_bid function I actually look at the dup.preview file for the DUP
session. You can get the same output by running bpduplicate with whatever
search parameters plus a -PM (preview media).
If you have already dup'ed the images, then you won't find what you are
looking, so if you want to use something like this report, you may want to
consider saving a copy of this -PM preview for future report runs.
David
PS. sorry its not documented all that well, I had to write it rather
quickly for a client and haven't had an opportunity to add comments.
<><><><><><><><><><><><><><><><><><><><>
David A. Chapa
Backup Storage Consultant
DataStaff, Inc.
http://www.datastaff.com
312 683 1144
---------------------------------------
-----Original Message-----
From: veritas-bu-admin AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu]On Behalf Of McAlister,
Bruce
Sent: Thursday, August 22, 2002 1:55 AM
To: 'veritas-bu AT mailman.eng.auburn DOT edu'
Subject: [Veritas-bu] Netbackup DR Tape List
Importance: High
Hi All,
I am looking for the easiest way to pull a tape list from netbackup that
will enable me to recover the entire system. We are running Netbackup 3.2GA
with Standard, Windows, SAP, Oracle classes defined. Each client, in most
instances have a combination of these class types defined, ie standard +
oracle, standard + sap etc etc. What I would like to do is, for each client,
pull the last successfull FULL backup tape list, the last successfull CINC
backup tape list, last successfull SAP or Oracle (database & archive) tape
list. At the end of it all, I would like to be able to use the report
generated by this script in a DR situation, I should be able to look at a
system, and say "right - i need these tapes to be recalled", and i should be
able to recover the system in full. I was wondering if anyone has any
suggestions, undocumented command parameters, scripts that would make this
whole excersize a load simpler than what it sounds.
Any comments and/or suggestions would be _greatly_ appreciated.
Thank you
Bruce McAlister
EDS Ireland c/o Xerox Ireland
UNIX System Administrator
* +353 1 608 6368
* bruce.mcalister AT irl.xerox DOT com
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
------=_NextPart_000_00B1_01C249D1.638D91D0
Content-Type: application/octet-stream;
name="dupimagechk.sh"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="dupimagechk.sh"
#!/bin/ksh=0A=
# -- Environment --=0A=
Hostname=3D`/bin/uname -n`=0A=
Me=3D`basename $0`=0A=
COPYNUM=3D1=0A=
CREATEDATE=3D`date +%m%d%y_%H%S%M`=0A=
WORKCLASS=3D/tmp/workclass=0A=
TOTALKB=3D0=0A=
REPORT=3D/tmp/dupimage_report=0A=
RECOVRYRPT=3D/tmp/RECOVRYRPT=0A=
DUPSESSION=3D$1=0A=
DUPPARAM=3D$2=0A=
CLIENT=3D""=0A=
IMAGEID=3D""=0A=
BPDBM=3D/usr/openv/netbackup/bin/bpdbm=0A=
DUPCRFILE=3D/tmp/dupcreate=0A=
VAULT=3D/usr/openv/netbackup/vault=0A=
VAULTDIR=3D`grep ^bpvault_dir $VAULT/production/$DUPPARAM| awk '{print =
$2}'`=0A=
VAULTNAME=3D`grep ^vault $VAULT/production/$DUPPARAM|awk '{print
$2}'`=0A=
DUPSESS=3DDUP$DUPSESSION=0A=
DUPMEDIA=3D/tmp/dupmediarecovery=0A=
CURRCLNT=3D"xNONAMEx"=0A=
RECOVER_FORMAT=3D/tmp/tempworkfile=0A=
REPORTDIR=3D`grep ^report_dir $VAULT/production/$DUPPARAM|awk awk =
'{print $2}'`=0A=
RECOVER_REPORT=3D$REPORTDIR/RECOVER_REPORT_$DUPSESS.$CREATEDATE.txt=0A=
IMGLISTOUTP=3D/tmp/bpimagelist.outp=0A=
# ---FUNCTIONS---=0A=
#=0A=
# --Clean Up Logs--=0A=
cleanuplogs()=0A=
{=0A=
if [ -f $DUPMEDIA.$DUPSESS ];then=0A=
rm $DUPMEDIA.$DUPSESS=0A=
fi=0A=
if [ -f $DUPCRFILE ];then=0A=
rm $DUPCRFILE=0A=
fi=0A=
if [ -f $REPORT ];then=0A=
rm $REPORT=0A=
fi=0A=
if [ -f $IMGLISTOUTP ];then=0A=
rm $IMGLISTOUTP=0A=
fi=0A=
if [ -f $WORKCLASS.* ];then=0A=
rm $WORKCLASS.*=0A=
fi=0A=
if [ -f $RECOVER_REPORT ];then=0A=
rm $RECOVER_REPORT=0A=
fi=0A=
if [ -f /tmp/$DUPSESS.mediafound ];then=0A=
rm /tmp/$DUPSESS.mediafound=0A=
fi=0A=
}=0A=
# --End Clean Up Logs--=0A=
# --Usage---=0A=
usage()=0A=
{=0A=
echo ""=0A=
echo "Usage:"=0A=
echo ""=0A=
echo "dupimageck.sh <DupSessionNumber> <dup_param_file>"=0A=
echo ""=0A=
echo "ex."=0A=
echo ""=0A=
echo "dupimageck.sh 92 dup_param_V100_full"=0A=
echo ""=0A=
echo ""=0A=
echo ""=0A=
echo ""=0A=
echo ""=0A=
echo "Exiting"=0A=
exit 1=0A=
}=0A=
# --End Usage--=0A=
#=0A=
# --Find Backup Images--=0A=
#=0A=
findbid()=0A=
{=0A=
sort -k 1,1 $VAULTDIR/$DUPSESS/dup.preview.out | awk '{print $5}' | =
while read bid=0A=
do=0A=
bpimagelist -backupid $bid >> $IMGLISTOUTP=0A=
done=0A=
}=0A=
# --End Find Backup Images--=0A=
#=0A=
# --Workclass Function--=0A=
#=0A=
workclass()=0A=
{=0A=
cat $IMGLISTOUTP | =0A=
while read line=0A=
do=0A=
if [ `echo $line | awk '{print $1}'` =3D "IMAGE" ];then=0A=
CLIENT=3D`echo $line | awk '{print $2}'` # Client Name=0A=
DATE1=3D`echo $line | awk '{print $3}'` # Date1=0A=
DATE2=3D`echo $line| awk '{print $4}'` # Date2=0A=
VERSION=3D`echo $line | awk '{print $5}'` # Image Version
level=0A=
IMAGEID=3D`echo $line| awk '{print $6}'` # Backup ID=0A=
CLASS=3D`echo $line | awk '{print $7}'` # Class Name=0A=
CLASSTYPE=3D`echo $line | awk '{print $8}'` # Class Type=0A=
=0A=
case $CLASSTYPE in =0A=
0) UCLASS=3D"Standard";;=0A=
1) UCLASS=3D"UNDEF";;=0A=
2) UCLASS=3D"UNDEF";;=0A=
3) UCLASS=3D"Apollo-wbak";;=0A=
4) UCLASS=3D"Oracle";;=0A=
5) UCLASS=3D"UNDEF";;=0A=
6) UCLASS=3D"Oracle";;=0A=
7) UCLASS=3D"Sybase";;=0A=
8) UCLASS=3D"UNDEF";;=0A=
9) UCLASS=3D"UNDEF";;=0A=
10) UCLASS=3D"Netware";;=0A=
11) UCLASS=3D"DataTools-SQL-BackTrack";;=0A=
12) UCLASS=3D"Auspex-FastBackup";;=0A=
13) UCLASS=3D"MS-Windows-NT";;=0A=
14) UCLASS=3D"OS/2";;=0A=
15) UCLASS=3D"MS-SQL-Server";;=0A=
16) UCLASS=3D"MS-Exchange-Server";;=0A=
17) UCLASS=3D"SAP";;=0A=
18) UCLASS=3D"DB2";;=0A=
19) UCLASS=3D"NDMP";;=0A=
20) UCLASS=3D"FlashBackup";;=0A=
21) UCLASS=3D"Split-Mirror";;=0A=
esac=0A=
# Use UCLASS for the
User Readable Format=0A=
PROXYCLNT=3D`echo $line | awk '{print $9}'` # Proxy
Client=0A=
CREATOR=3D`echo $line | awk '{print $10}'` # Creator=0A=
SCHED=3D`echo $line | awk '{print $11}'` # Schedule Label=0A=
SCHEDTYPE=3D`echo $line | awk '{print $12}'` # Schedule
Type=0A=
RL=3D`echo $line | awk '{print $13}'` # Retention Level=0A=
BACKUPTIME=3D`echo $line | awk '{print $14}'` # Backup Time=0A=
ELAPSETIME=3D`echo $line | awk '{print $15}'` # Elapse Backup Time=0A=
EXPIR_UTIME=3D`echo $line | awk '{print $16}'` # Expiration date of =
first copy to expire. =0A=
# 0 denotes image
inprogress or failed=0A=
EXPIRATION=3D`$BPDBM -ctime $EXPIR_UTIME | awk -F=3D '{print =
$2}'|awk '{print $2, $3, $5}'`=0A=
# EXPIRATION is a User
Readable Format=0A=
COMPRESSION=3D`echo $line | awk '{print $17}'` # Compression; 1 =
(yes) 0 (no)=0A=
ENCRYPT=3D`echo $line | awk '{print $18}'` # Encryption; 1(yes) or
=
0 (no)=0A=
KBYTES1=3D`echo $line | awk '{print $19}'` # KBs Written=0A=
NUMFILES=3D`echo $line | awk '{print $20}'` # Number of
Files=0A=
COPIES=3D`echo $line | awk '{print $21}'` # Number of Copies=0A=
NUMFRAGS=3D`echo $line | awk '{print $22}'` # Number of
Fragments=0A=
IMGFILECOMP=3D`echo $line | awk '{print $23}'` # Image File =
Compressed 1 (yes) 0 (no)=0A=
IMGFILE=3D`echo $line | awk '{print $24}'` # Image File Name=0A=
SOFTVER=3D`echo $line | awk '{print $25}'` # Software Version=0A=
NAME1=3D`echo $line | awk '{print $26}'` # Name1=0A=
BPIMGLSTOPTIONS=3D`echo $line | awk '{print $27}'` # bpimagelist =
options 1 (yes) 0 (no)=0A=
PRICOPYNUM=3D`echo $line | awk '{print $28}'` # Primary Copy
Number=0A=
IMGTYPE=3D`echo $line | awk '{print $29}'` # Image Type =0A=
TIRINFO=3D`echo $line | awk '{print $30}'` # TIR Recovery Info=0A=
TIREXPIR=3D`echo $line | awk '{print $31}'` # TIR Recovery =
Expiration=0A=
KEYWORDS=3D`echo $line | awk '{print $32}'` # Keywords=0A=
MPX=3D`echo $line | awk '{print $33}'` # Multiplexing 1 (yes)
0 =
(no)=0A=
EXTSECURITYINFO=3D`echo $line | awk '{print $34}'` # Extended =
Security Information=0A=
INDFILRESTFRMRAW=3D`echo $line | awk '{print $35}'` # Independent =
File Restore from RAW=0A=
IMGDUMPLVL=3D`echo $line | awk '{print $36}'` # Image Dump Level=0A=
FILESYSONLY=3D`echo $line | awk '{print $37}'` # File System Only=0A=
PREVBLOCKINCRTIME=3D`echo $line | awk '{print $38}'` # Previous =
Block Incr Time=0A=
BLOCKINCRFULLTIME=3D`echo $line | awk '{print $39}'` # Block Incr =
Full Time=0A=
OBJDESC=3D`echo $line | awk '{print $40}'` # Object Description=0A=
REQID=3D`echo $line | awk '{print $41}'` # Request ID=0A=
BACKSTAT=3D`echo $line | awk '{print $42}'` # Backup
Status=0A=
=0A=
if [ "$CURRCLNT" =3D "$CLIENT" ];then=0A=
NOECHO=3D0=0A=
else=0A=
NOECHO=3D1=0A=
CURRCLNT=3D$CLIENT=0A=
echo "$CLIENT, $SCHED" >> $WORKCLASS.$CLASS=0A=
fi=0A=
elif [ `echo $line | awk '{print $1}'` =3D "FRAG" ] # Start looking =
at Line 2 - n+1 FRAG lines=0A=
then=0A=
COPYNUM=3D`echo $line | awk '{print $2}'` # Copy number of this =
Fragment=0A=
FRAGNUM=3D`echo $line | awk '{print $3}'` # Fragment Number, or =
-1 for a TIR Fragment=0A=
KBYTES=3D`echo $line | awk '{print $4}'` # Size of the Fragment =
in KB=0A=
INTVAL1=3D`echo $line | awk '{print $5}'` # Undocumented=0A=
MTYPE=3D`echo $line | awk '{print $6}'` # Media Type (2 for =
removable; 0 for disk)=0A=
DENSITY=3D`echo $line | awk '{print $7}'` # Density (removable =
only)=0A=
=0A=
case $DENSITY in =0A=
0) UDEN=3D"qscsi";;=0A=
1) UDEN=3D"8mm (hc8mm)";;=0A=
2) UDEN=3D"800-openreel";;=0A=
3) UDEN=3D"1600-openreel";;=0A=
4) UDEN=3D"3200-openreel";;=0A=
5) UDEN=3D"6250-openreel";;=0A=
6) UDEN=3D"hcart";;=0A=
7) UDEN=3D"8mm";;=0A=
8) UDEN=3D"t120";;=0A=
9) UDEN=3D"odiskwm";; =0A=
10) UDEN=3D"odiskwo";;=0A=
11) UDEN=3D"8mm";;=0A=
12) UDEN=3D"4mm";;=0A=
13) UDEN=3D"dlt";;=0A=
14) UDEN=3D"hcart2";;=0A=
15) UDEN=3D"dlt2";;=0A=
16) UDEN=3D"8mm";;=0A=
17) UDEN=3D"8mm2";;=0A=
18) UDEN=3D"d2";;=0A=
19) UDEN=3D"dtf";;=0A=
20) UDEN=3D"hcart3";;=0A=
21) UDEN=3D"dlt3";;=0A=
22) UDEN=3D"disk";;=0A=
esac=0A=
# This Density Chart
may be incorrect=0A=
=0A=
FNUM=3D`echo $line | awk '{print $8}'` # File Number, this is =
the n-th =0A=
# backup on this medium
(rem only)=0A=
MEDIAID=3D`echo $line | awk '{print $9}'` # MediaID or Absolute =
Path where image is stored=0A=
MEDIASRVR=3D`echo $line | awk '{print $10}'` # Media Server who =
owns this image=0A=
BLOCKSIZE=3D`echo $line | awk '{print $11}'` # Num KB per block =
for this medium=0A=
OFFSETVAL=3D`echo $line | awk '{print $12}'` # Offset=0A=
CREATEDATE=3D`echo $line | awk '{print $13}'` # Media Date and =
Time this was allocated (utime)=0A=
# The assumption for
duplications is that the allocated=0A=
# time is the creation
time=0A=
DUPCREATE=3D`$BPDBM -ctime $CREATEDATE | awk -F=3D '{print $2}' | =
awk '{print $2, $3, $5}'`=0A=
# Use DUPCREATE for a
User Readable Format=0A=
DWO=3D`echo $line | awk '{print $14}'` # Device Written On,
very =
handy=0A=
INTVAL2=3D`echo $line | awk '{print $15}'` #
Undocumented=0A=
INTVAL3=3D`echo $line | awk '{print $16}'` #
Undocumented=0A=
FRAGEXPIR=3D`echo $line | awk '{print $17}'` # Expir of copy, =
applies only when FRAG num is 1=0A=
MPX=3D`echo $line | awk '{print $18}'` # Indicates whether
this =
copy is MPX'd =0A=
# 1-yes, 0-no;only on
FRAG 1=0A=
=0A=
echo "$MEDIAID, $UDEN, $DUPCREATE, $COPYNUM" >> $WORKCLASS.$CLASS=0A=
fi=0A=
# done=0A=
done=0A=
}=0A=
# --End Workclass---=0A=
#=0A=
# --Final Recovery Report--=0A=
#=0A=
recoveryrpt()=0A=
{=0A=
cp /dev/null $RECOVER_FORMAT=0A=
printf "%5sRecovery Report for Vault Database: ($VAULTNAME)" >> =
$RECOVER_REPORT=0A=
echo "" >> $RECOVER_REPORT=0A=
printf "%5sTo recovery all classes from date $START to date $END" >> =
$RECOVER_REPORT=0A=
echo "" >> $RECOVER_REPORT=0A=
for i in `ls $WORKCLASS.*`=0A=
do=0A=
CLASSNAME=3D`echo $i | awk -F. '{print $2}'`=0A=
printf "%5sClass: $CLASSNAME\n" >> $RECOVER_REPORT=0A=
echo $i=0A=
cat $i | while read line =0A=
do=0A=
if [ `echo $line | awk '{print NF}'` -eq 2 ];then=0A=
CLNTNAME=3D`echo $line |awk -F, '{print $1}'` =0A=
SCHEDNAME=3D`echo $line | awk -F, '{print $2}'`=0A=
elif [ `echo $line | awk '{print NF}'` -eq 6 ];then=0A=
MEDIA=3D`echo $line | awk -F, '{print $1}'`=0A=
DENSITY=3D`echo $line | awk -F, '{print $2}'`=0A=
DATE=3D`echo $line | awk -F, '{print $3}'`=0A=
COPY=3D`echo $line | awk -F, '{print $4}'`=0A=
printf "%7sClient: $CLNTNAME%7sSched: $SCHEDNAME%3sMedia: =
$MEDIA%2sDensity: $DENSITY%3sDate: $DATE%3sCopy: =
$COPY\n">>$RECOVER_FORMAT=0A=
fi=0A=
cat $RECOVER_FORMAT | sort -u >> $RECOVER_REPORT=0A=
cp /dev/null $RECOVER_FORMAT=0A=
done=0A=
echo "">> $RECOVER_REPORT=0A=
done=0A=
}=0A=
# --End Final Recovery Report---=0A=
#=0A=
# ---End FUNCTIONS---=0A=
#=0A=
# --Begin Main Script---=0A=
if [ $# !=3D 2 ];then=0A=
usage=0A=
fi=0A=
#=0A=
if [ ! -f $VAULTDIR/$DUPSESS/dup.preview.out ];then=0A=
echo "FATAL ERROR: No $VAULTDIR/$DUPSESS/dup.preview.out file was =
found"=0A=
echo "Exiting"=0A=
exit 2=0A=
fi=0A=
START=3D`sort -k 1,1 $VAULTDIR/$DUPSESS/dup.preview.out | head -1 | awk =
'{print $1}'`=0A=
END=3D`sort -k 1,1 $VAULTDIR/$DUPSESS/dup.preview.out | tail -1 | awk =
'{print $1}'`=0A=
#=0A=
# Call Functions=0A=
cleanuplogs=0A=
findbid=0A=
workclass=0A=
recoveryrpt=0A=
# Script Done=0A=
exit 0=0A=
------=_NextPart_000_00B1_01C249D1.638D91D0--
|