Video Screencast Help

Scripted Restore Job

Created: 13 Oct 2010 | 13 comments

Hello,

after spending some time on research, I found out that Backup Exec doesn't support scheduling of Restore Jobs and decided to try out creating a scripted restore job.

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.

The backup job uses a Backup 2 Disc Folder for the Backup and the media label is "B2D000064.bkf".

My restore script is the following

----------------------------------------------------

[General]

JOB_TYPE=Restore
JOB_NAME=RESTORE TEST
SERVER=MyBackupServer
 
[Restore_Options]
RESTORE_EXISTING=1
RESTORE_CORRUPT_FILES=1
RESTORE_SECURITY=1
RESTORE_PRESERVE=1
 
/*Device*/
DEVICE_NAME=RydexDB
 
/*File Redirection*/
SHARE_REDIRECT_DRIVE=\\MyRedirectServer\C:
SHARE_REDIRECT_PATH=\
 
[Selections]
SELECTION1=\\Server2\ITONE\ITONEStore\Rydex\Archive\Databases\RMX2MTA\*.*
--------------------------------------------------------
 
Afterwards I run this script using
bemcmd -o90 -v -f"c:\restore1.txt"
 
and my result is
-------------------------------
Connecting to media server '\\MyBackupServer'...
Connected.
Reading script file...
Getting device 'RydexDB'...
Getting list of drives...
Getting list of device pools...
Getting list of backup-to-disk devices...
Success.
Inserting schedule...
Inserting job...
ERROR CODE: -536837664
ERROR: No records were found on database request.
 
Disconnecting from server...
Disconnected.
RETURN VALUE: -1
-------------------------------
 
As far as I understand I get something wrong with the SELECTION entry. I have tested it in many variations and haven't got it to work. Ideally I want it to work with the wildcard but even trying it with a concrete file name hasn't worked.
Is it correct that this entry should include the location that the file(s) are stored in from the beginning, meaning the location that has been backed up?
If I manage to get this job to work with the selection list, I want to set it to run on a weekly basis using the Windows Task Scheduler.
 
Any help will be really appreciated!

Comments 13 CommentsJump to latest comment

Colin Weaver's picture

It is not that simple - as you need to specify information relating to which backup set you want to restore as otherwise if you backed up the same data in multiple jobs we can't tell which data you want back.

If you look at the Command Line (BEMCMD) Admin guide section on restore job script files you will see the the -o90 option also states that  "The Job History GUID is required for bemcmd - o90 restores. To obtain the Job
History GUID, first use -o23 and /or -o506 to obtain the Job Instance GUID. Then
use the Job Instance GUID with -o21 to obtain the Job History GUID"

This value is used inside the script file so you have to somehow use bemcmd to get the Job History Guid, then manipulate that output  and add it into your restore script file and then run the bemcmd -o90 option to do the restore.

As the job history Guid changes for the last job every time you run the job this process has to be dynamic so good luck with the required scripting.

kstasky's picture

So if I understand you correctly I need the Job History GUID for the -o90 Restore? What bemcmd option can I use to run the restore with a selection list? The problem is, if I run it with the Job History GUID, I figure that I have to automate the following steps:

- running of -o21 option to get the "weekly" Job History GUID

- parsing the output of the previous command to get the correct GUID

- passing the GUID to the restore script file and running it

As you said, I considered this to be pretty much effort and hence tried out the Selection List method. Therefore I don't really understand the first part of your answer, what more information do I need to specify. Every time I want back the data of the last backup...

Colin Weaver's picture

Bemcmd needs to know the JobHistoryGuid for the last backup so you have to supply it hence why the Admin guide says the history guid is required.

We have been asked for a feature to make a regular restore from last backup before and the answer is the same

Backup Exec does not currently have a built in feature to do it, the only way to do it is to take the output of a beccmd to find the job history guid and script the result so that it can be used with the bemcmd to start a restore job.

Writing such scripts is however beyond what Backup Exec Technical Support offer - although you might find another customer that is good with vbs scripting or similar that has found the way to combine all the information to do what you want.

kstasky's picture

First of all thank you for the answers. Furthermore, my hope was to find a customer like the one you are describing who has found some solution to do what I want :-)

One more thing: In the manual I have (Command Line Applet) it says that I can use either JobHistoryGuid OR Selection List (Selectionx). Is that not true?

yann ARMAND's picture

Hello Collin,

Please report the following to your software engineers to get us a fix.

I'm software engineer at Xinet (www.xinet.com) and we provide an Archive add-on to our system based on BackupExec for windows install. This add-on is actually broken because of that bug.

Regards.

Hello kstasy,

You loose your time with bemcmd -o90, this feature is bugged (like lots other) and have been totally destroyed in last BackupExec version (2010).

I've been working with BE through bemcmd since version 9 and here is how it was working, and how it (doesn't) work now.

You are absolutely right JobHistoryGUID and SelectionX CAN'T be use together :

- If you use JobHistoryGUID, the selection get all files backed-up for this job.

- if you use SelectionX, the selection get the last backup job and extract only the files you specify in SelectionX pattern.

- if you use both JobHistoryGUID and SelectionX, it simply ignore SelectionX and select all JobHistory files.

- The only way to select a given file for a given backupJob should be to use SelectionX and a time window with START_DATE/END_DATE. I have to say I never succeed such a selection, it select a random one or the last backup job.

The best way to produce a Restore script that handle international chars is to use UTF-16 little endian. 

Since BE2010, the SelectionX options ALWAYS respond with the error you report. I guess for a char coding issue.

The only way to restore using o90 is to use JobHistoryGUID.

To restore what you want, you create such a restore job with setting HOLD=1, then you hack the DB to modify the selection.

But the usage of JobHistoryGUID have a MAJOR issue: if you flush your job log, all job history are lost.

That mean, if job history is flushed by hand or using the option to do it automatically (90 days by default on every fresh BE install), you CAN'T RESTORE ANYMORE using bemcmd.
 

Colin Weaver's picture

Hello Yann

This is a community assisted forum that some Symantec staff take the time to contribute on - if you think you have a defect against Backup Exec then please open a formal support case so it can be fully investigated.

akimencoj's picture

Can anyone give an example to test a Restore Script ?

I want to test and be sure that it Will work.

We have NEt Backup 7.5. over a Windows Platform.

Our idea is to have an script that can restore a files according to some date like name of file and date. Is that possible ?

Regards, juan

Hywel Mallett's picture

If you have NetBackup, then you should post a new thread in the NetBackup forum. Also, I thought 7.0 was the latest version of NetBackup.

Colin Weaver's picture

For information we have reproduced this problem and acknowledge it in

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

The above document does contain a workaround - but take note of the caution about it's use

Against the information from the original poster (kstasky) there were some things wrong with the restore job script that whilst not a cause of the error would not help achieve a restore.

1) Setting the JOB_NAME parameter will only work once, unless you manually go and delete the restore job details from Backup Exec before you run the bemcmd restore request again.

2) Setting the RESTORE_SECURITY=1 and using a redirect restore will actually result in a succesful job (using the workaround for the problem above) but no files are restored - this is because 1 is restore security only, 0 is restore files and security

Colin Weaver's picture

Also we were unable to get 12.5 to work at all (even using the workaround) the failure message is slightly different but it still fails - So on our test evidence we are not sure when using the SELECTIONx parameter stopped working - but the failure does not appear to be unique to BE 2010/2010 R2.

kstasky's picture

Hello Colin and thank you for your time.

I don't quite understand you, do you mean that with the changes you provide in your post and with the workaround in the link we might be able to get our "automatic" backup to work? Or can we totally forget it with BE 12.5?

Furthermore, we are currently setting up BE 2010, will it be better to try it out there?

kstasky's picture

One more question in order to close this issue:

Since we are upgrading, is it possible to handle this automated restore with NetBackup?

Colin Weaver's picture

You might need to ask on the NetBackup forum for that one - although it is possible that there are forum members that are familar enough with both products.