Script to expire images using bpexpdate in a Windows Environment
Created: 20 Apr 2010 | Updated: 27 Oct 2010 | 5 comments
Hi
I am looking for help in scripting; that I can use to manually expire some images on my tapes.
My NetBackup environment is all Windows.
Thanks
Discussion Filed Under:
Comments 5 Comments • Jump to latest comment
Use bpexpdate : Change the expiration date of backups in the image catalog and media in the media catalog.
For example:
bpexpdate -backupid eel_0904219764 -d 0 : expire an image
bpexpdate -m BU0002 -d 0 : expire a tape
make a file - I called it expire.bat
put this in it. (if your install path is different please change it)
"C:\Program Files\VERITAS\NetBackup\bin\admincmd\bpmedialist.exe" -m %1
"C:\Program Files\VERITAS\NetBackup\bin\admincmd\bpexpdate.exe" -m %1 -d 0
"C:\Program Files\VERITAS\NetBackup\bin\admincmd\bpmedialist.exe" -m %1
save file.
expire.bat <TAPE NUMBER>
here is output
expire.bat H00006
Server Host = mymaster
id rl images allocated last updated density kbytes restores
vimages expiration last read <------- STATUS ------->
--------------------------------------------------------------------------------
H00006 12 2 08/13/2006 00:04 N/A dlt 122566743 0
MPX 10/19/2010 20:30 04/19/2010 18:57 IMPORTED
Media H00006 is due to expire at 10/19/2010 20:30:52
Are you sure that the data on this media is not critical to
your business, and you are sure you want to delete H00006 y/n (n)? y
requested media id is not assigned to this host in the EMM database
--------------
First it looks up the tape and shows it to you -
Then it asks if you really want to expire the images on the tape.
Then it looks it up again - this should have the error that it is not in the EMM database, meaning it was succesfull in expireing all the images on the tape. If it comes back and shows you the tape info again - then it did not expire it.
I don't have to know how to spell....I work on Unix.
NetBackup 7.0.1 - AIX & Windows
Hi J.Hinchcliffe,
Thanks for sharing your script.
I would like to be able to delete images from several tapes at a go. Can you please let me know how I can achieve that.
I am Very Friendly with MS Excel So..
I used to go TLD and check for list of tapes to expire and select all of them and Press CTRL+C.
Open Excel CTRL+V. Delete all Fields except MEDIA ID. Insert a Column before that MEDIA ID Columns and Enter "bpexpdate -d 0 -force -m " and on column 3 enter "=CONCATENATE(A1,B1)" and the output will be "bpexpdate -d 0 -force -m MEDIAID"
Just drag this same formula for all Media's and copy all of these.
Goto CMD-> C:\INSTALPATH\Netbackup\Bin\Admincmd\ and paste those copied things ( or you can also paste in notepad and save as bat file and execute it)
Its more read all these lines but when you do it, it really 1 min job :-) no need to shake up your mind :-)
Thanks, Karthikeyan Sundaram.
You already have expire.bat
Change line 2
From
"C:\Program Files\VERITAS\NetBackup\bin\admincmd\bpexpdate.exe" -m %1 -d 0
To
"C:\Program Files\VERITAS\NetBackup\bin\admincmd\bpexpdate.exe" -m %1 -d 0 -force
This way it will not ask you for every tape up to you
Now create a new file called tapelist.txt
In it put your media id's
One per line
T0001
T0002
T0003
Now make a new bat file called expiremany.bat
echo off
for /f %%t in (tapelist.txt) do expire.bat %%t
echo on
----------
now you can run expire.bat for just 1 tape
expire.bat T0001
or expiremany.bat for many tapes that are listed in the tapelist.txt file.
expiremany.bat
it will still show you each tape, but of you use the -force in expire.bat it will not ask for you to say yes before it expires it.
I don't have to know how to spell....I work on Unix.
NetBackup 7.0.1 - AIX & Windows
Would you like to reply?
Login or Register to post your comment.