cancel
Showing results for 
Search instead for 
Did you mean: 

Scripted automated Restore

kstasky
Level 3

Hello,

I hate myself for posting here without doing any research, but we got NetBackup installed recently, I have no idea how it works, but I am being put under pressure to create a scripted restore job. Therefore I wanted to ask whether what I want to do is possible and whether there is anything already existing in that direction.

My case is the following: I am backing up a folder (located at \\Server2\ITONE\ITONEStore\Rydex\Archive\Databases\RMX2MTA) that includes 2 .mdb files on a weekly basis, say every Monday morning. Afterwards I want to restore these 2 files to a different server. These 2 files change on a monthly basis, hence I cannot use their names.

Is it possible to create and schedule some automated weekly restore job and make it restore the 2 files it finds at the specified location, regardless of their name?

Any help will be really appreciated! 
7 REPLIES 7

J_H_Is_gone
Level 6

Not within the GUI,

but you can do a restore at command line.

So you could write a script that that gets the name of your files (from somewhere) and then have that feed as a variable into the restore command, doing all of this in a script file.

You would have to schedule the restore script via windows job scheduler or UNIX cron depending on what your master is.

Manoj_Siricilla
Level 4
Certified

Hey Kstasky,

Netbackup doesn't provide an option to schedule restores like the way you can do with backups.

You have to rely on OS schedulers or some third party schedulers.  Short answer: It is possible to automate restore jobs.

1. Is your master server a unix or windows box?

2. You said the files inside the folder change. What about the folder name, does it change too?

3. When you say,"After wards I want to restore..." does that mean you want to restore on the same day after the backup is completed?

J_H_Is_gone
Level 6

"Monday morning. Afterwords I want to restore these 2 files to a different server.  "

 

with this - I am thinking that you backup these files then when the backup finishes you want to right away do a restore.

1) the tape would have to NOT be used by any other backups, or you would have to wait for that tape to be free before the restore will start.

2) use the Parent_end_notify script.

this is found in the bin dir

When doing a backup job with mulit streams you get

parent job (id)  that checks the shadow copy and snap shot .....

then it kicks off a child job (id) for each drive on a windows server (each fs on a unix server)

when all the children have finished the parent will then end, but just before it ends it will run the parent_end_notify script located on the master ( it is only run on the master)

the script gets some input

# receives 7 parameters:

# CLIENT - the client hostname

# POLICY - the policy label

# SCHEDULE - the schedule label

# SCHEDULE_TYPE - the type of schedule: FULL INCR UBAK UARC

# STATUS - the backup status for this job

# STREAM - the backup stream number for this job always -1

# STREAM_CNT - # streams started (if -1, genjob failed to call pem

) 

 

So you could write a IF statement within the script testing for the Client name, maybe the policy and schedule name, and the status  .... then if the parent job finished with a 0 ( which means all child jobs also finished with a 0 - if any child finish with a 1 or other return code the parent gets the same code)

then within your If statement in the parent_end_notify script you can have it figure out what files you want it to restore (as you say the names change) and then use the bprestore command in the script to restore your files.

My parent_end_notify script on my master has 5 different If statements in it, looking to do something for 5 different backups when they finish.

Check out the admin guide for the use of the Parent_end_notify script.

mph999
Level 6
Employee Accredited

Does this help ...

 

http://www.symantec.com/docs/TECH143238

 

Martin

kstasky
Level 3

Hello,

1. Our Master server is a Windows box, hence we will have to use the Windows Task Scheduler.

2. The folder name doesn't need to change.

3. It would be nice to schedule the restore to happen on the same day as the backup.

Thanks for the help up to now!

J_H_Is_gone
Level 6

your windows master will still have the parent_end_notify script.

You just test for the imput for your backup job that finishes and the have it kick of the restore to the other servers.

kstasky
Level 3

Thanks for all the help, I got some more time assigned for the project so I will test it out and let you know.