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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduling Tape Duplication 1

Status
Not open for further replies.

AlexChao

Technical User
May 16, 2003
44
0
0
SG

Can tape duplication be scheduled from the UI of NetBackup 5.1 MP1 ? It seems that Veritas has no provision for this need.

If this is so, I would like to explore scheduling tape duplication using bpduplicate command to duplicate all backup tapes used on a certain day of the week.

Can anyone share experience on this?

Thanks.

 
The only way to schedule this (bpduplicate) is by writing scripts. If you want to automate this in the scheduler, you need to purchase the Vaulting Option.
 
Here is an old post from the VERITAS user community. I don't know the validity of any scripts because of the age, but you can further research this group.


Hi,

Ever since we purchased NBDC 3.4 for W2K, I've noticed the lack of good
vb scripts, especially for vaulting. So I made my own and I'm sharing them
with you all in case you ever need them.
Let me first describe my setup, so that you can better understand the
scripts. We've got a 4 drive library. 2 of the drives are connected to the
master server and the other 2 to a second media server. The robot is
connected to the master server. We do Differential backups from monday to
thursday and full backups on the weekends. I've got 2 tapes for the
differentials and 6 for the full. Each morning, I've got operators that run
these scripts to copy the backups from the previous night to tapes that have
been inserted into the library. Once the duplication is done, the tapes are
ejected and taken offsite for 28 days. Once a month, the full backups are
copied on special monthly tapes that are taken offsite for a year. I've got
a volume pool for duplicates (DUP), one for full (FULL), for differential
(DIFF). My tapes are labeled according to the type of backups that are on
them and when they are used. All these scripts are setup to manually run
using Scheduled Tasks, so the operators don't need to be admins of the
master server and they can run the scripts remotely.

These scripts are totaly free of charge. I don't support them but I'll
gladly answer questions about them if I've got the time. Just make sure you
understand them before using them, otherwise, I'm not responsible for any
lost of data.

Here's the code and some explanations so you can customize them:

The first one is for inventorying a library:

Dim WshShell, TempCommand
Set WshShell = WScript.CreateObject ("WSCript.shell")
TempCommand = "E:\VERITAS\Volmgr\bin\vmupdate -rn 0 -rt tld -mt
hcart -involgrp PV136T -outvolgrp OFFSITE -empty_ie"
WshShell.run TempCommand, 0, True
Set WshShell = Nothing

I'm using 2 volume groups: "PV136T" and "OFFSITE". The first one is the name
of my library and the other one is for tapes that are shipped offsite.
Change the "-rn" param to the correct robot number (0 in my case). Change
the "-rt" param to the correct type of robot and set the "-mt" param to the
type of media (hcart in my case). The -involgrp param sets the volume group
for tapes that have been inserted into the library since the last inventory.
The -outvolgrp are for tapes that have been ejected from the library
(without using the eject function from NB). Finaly, the -empty_ie param
tells NB to load into the library any tapes that would be in the inport
(mailslot). Don't forget to change the path to the veritas installation
directory.


This second script ejects all the tapes that are in the library and that
start with "CD" or "CM", which, in my labeling system, means that they are
either daily copies or monthly copies:

Dim WshShell, TempCommand, fso, VMQFile, VMQList, TempVMQLine, WorkVar1
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists("C:\TEMP\VMQUERYLIST.TXT")) Then
fso.DeleteFile "C:\TEMP\VMQUERYLIST.TXT", true
End If
Set WshShell = WScript.CreateObject ("WSCript.shell")
TempCommand = "cmd /C E:\veritas\Volmgr\bin\vmquery.exe -v
PV136T -b>C:\TEMP\VMQUERYLIST.TXT"
wshShell.run TempCommand, 0, True
Set VMQFile = fso.GetFile("c:\temp\VMQUERYLIST.TXT")
Set VMQList = VMQFile.OpenAsTextStream(1, 0)
Do While VMQList.AtEndOfStream <> True
TempVMQLine = VMQList.ReadLine
WorkVar1 = Left(TempVMQLine, 6)
If (Left(WorkVar1,2) = "CD") OR (Left(WorkVar1,2) = "CM") then
TempCommand = "cmd /C echo |e:\VERITAS\Volmgr\bin\vmchange.exe -res -m " &
WorkVar1 & " -mt HCART -e -v OFFSITE"
wshShell.run TempCommand, 0, True
End If
Loop
VMQList.Close
Set WshShell = Nothing



Here's the script that we use to duplicate the backups:

Dim WshShell, TempCommand, TempYear, TempMonth, TempDay, TempHour,
TempMinute
Set WshShell = WScript.CreateObject ("WSCript.shell")
TempYear = CStr(Year(Date))
TempMonth = CStr(Month(Date))
If Len(TempMonth) < 2 Then
TempMonth = "0" & TempMonth
End If
TempDay = CStr(Day(Date))
If Len(TempDay) < 2 Then
TempDay = "0" & TempDay
End If
TempHour = CStr(Hour(Time))
If Len(TempHour) < 2 Then
TempHour = "0" & TempHour
End If
TempMinute = CStr(Minute(Time))
If Len(TempMinute) < 2 Then
TempMinute = "0" & TempMinute
End If
TempCommand = "e:\VERITAS\NetBackup\bin\admincmd\bpduplicate.exe -shost
smuapinfbac01 -dstunit PV_BAC01 -st CINC -dp DUP -hoursago 24 -v -L
e:\VERITAS\Logs\Duplicates\BAC" + TempYear + "-" + TempMonth + "-" + TempDay
+ "-" + TempHour + "h" + TempMinute + ".TXT -mpx"
WshShell.run TempCommand, 0, True
Set WshShell = Nothing


This script logs everything is a file with today's date in it's name, so
that the operators can verify that the duplication was successfull. I'm
using the "-shost" param to duplicate only the backusp that were done from
the master server. I've got another copy of this script to duplicate the
backups from the second media server. The reason I'm doing it this way is to
make sure that the duplicates aren't done across the network but instead,
that they use the 2 drives from the same server to copy the images. That's
where the "-dstunit" param comes into play. It specifies the storage unit
that's on the master server in this case. The script looks for Cummulative
Incremental backups that have started in the last 24 hours. There's alot of
code at the begining to make sure that the filename always looks the same
way.

Note: Be carefull with the "-mpx" switch. Veritas has told me that there's a
bug in the 341_2 patch. If you try to use the -mpx switch to preserve
mutiplexing in your dupplicates (to make the duplication faster), you'll get
code 24 errors if you've got 341_2 installed. So if you need 341_2, do use
the "-mpx". If you've got 341_1 or less, then use it.


After the backups have been copied and the duplicates ejected, this script
sets the expiration for the duplicates to 27 days, so that they expire just
before we put them back into the library a month later. The primary copies
of our backups always stay in the library and they expire after a week.

Dim WshShell, TempCommand, fso, ExpFile, ExpList, TempExpLine, WorkVar1,
WorkVar2, WorkVar3, WorkVar4
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists("C:\TEMP\BPEXPLIST.TXT")) Then
fso.DeleteFile "C:\TEMP\BPEXPLIST.TXT", true
End If
Set WshShell = WScript.CreateObject ("WSCript.shell")
TempCommand = "cmd /C
E:\veritas\NetBackup\bin\admincmd\bpimagelist.exe -idonly -hoursago 24 -st
CINC>C:\TEMP\BPEXPLIST.TXT"
wshShell.run TempCommand, 0, True
Set ExpFile = fso.GetFile("c:\temp\BPEXPLIST.TXT")
Set ExpList = ExpFile.OpenAsTextStream(1, 0)
Do While ExpList.AtEndOfStream <> True
TempExpLine = ExpList.ReadLine
WorkVar1 = InStr(TempExpLine,"ID: ")
WorkVar2 = InStr(TempExpLine," CINC")
If (WorkVar1 > 0) and (WorkVar2 > 0) then
WorkVar3 = Mid(TempExpLine, WorkVar1 + 4, WorkVar2 - WorkVar1 - 4)
WorkVar4 = DateAdd("d",27,Date)
TempCommand = "cmd /C
E:\veritas\NetBackup\bin\admincmd\bpexpdate.exe -backupid " & WorkVar3 &
" -d "& CStr(Month(WorkVar4)) & "/" & CStr(Day(WorkVar4)) & "/" &
CStr(Year(WorkVar4)) & " -copy 2 -force"
wshShell.run TempCommand, 0, True
End If
Loop
ExpList.Close
Set WshShell = Nothing


This script just produces a text file containing the backupids of last
night's backup. Then it extracts the backupids and sets the expiration for
copy #2 (the duplicate) to 27 days. I've got 2 other version of this script,
one for weekend backups that checks the last 72 hours instead of 24, and one
for montly copies, that also checks for the last 72 hours, but also sets the
expiration to 12 months.

That's all folks. Hope you like them. If you come up with other vbs scripts
for Netbackup, send them along...

Sylvain Doré
Senior Systems Administrator
Infrastructures
UAP inc.



Bob Stump
Just because the Veritas documentation states a certain thing does not make it a fact
 
and another post...


Our (still free!) NetBackup scripts are upgraded to version 2.0...

What's new? [New bugs :) ...]:
- handling two different offline locations (a "Vault" and a "Safe"),
- a new script "tapeeject" to explicitly eject a list of tapes by media-ID,
which honors our vaulting mechanism (and works with larger mailslots),
- several smaller improvements.

What's old?
- a decent vaulting mechanism with an easy-to-use interface for
ejecting and injecting tapes (even handling larger mailslots...),
- several automated reports to be sent to the operator on a daily,
weekly and monthly base,
- "tapereport": a much better replacement for available_media...,
- geared towards operators, no GUI, just easy command-line utilities.

Available at ftp://ftp.fokus.gmd.de/pub/vst/netbackup
File: nb_scripts_v20.tar.gz

You need: perl.
You should have: a unix based Netbackup server (we have Sun/Solaris --
Windows-installations probably need heavy modifications inside
the scripts :)
According to some reports the scripts run well under NB 4.5, although
we still are at NB 3.4.1 (patched...)

Usual warnings: it works for us, but it may be of no use for you,
check things before use. The scripts are considered "rough"...
You MUST modify at least some parameters before use!
--
Stephan Wasserroth (Systems- and Network-Manager)
Head of Technical Department
FhG-Fokus | Kaiserin-Augusta-Allee 31 | D-10589 Berlin
e-mail: wasserroth@fokus.gmd.de FAX: +49 30 3463-8253
PGP-Key fingerprint: B3 83 35 C1 84 32 AA C5 11 A9 30 AB 59 19 60 47


Bob Stump
Just because the Veritas documentation states a certain thing does not make it a fact
 

I was alway and finally got back to see the threads of my early June posting.

Thanks to Stumpr for sharing the script and providing such extensive details !!

 

Ooops....

Let me rephrase what I wrote earler:

Thanks to Stumpr for showing where to find the script :)

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top