cancel
Showing results for 
Search instead for 
Did you mean: 

Pre and post Batch files do not work when job runs

RCMORE
Level 3

Hello.  I have an issue where I am trying to backup and Oracle database on a different server.  The oracle client has been installed on the BackupExec server so it can connect to the Oracle database server.  I can manually run the batch files to "Shutdown and Startup" the remote database, yet when I add these batch files to the "Pre and Post" sections of the job, Backup exec and the job runs,but the batch files DO NOT execute.  There isn't an error on the job log itself and Backeupexec even shows that the job seems to run fine.  If I try to run the batch files manually, the usual black command line screen comes up and you can see the commands being execute.  This DOES NOT happen when the backup exec job runs even though it says everything ran successfully.  Here are a few other tidbits that may be relevant.

I am using 2003 server 6bit
Oracle Client is installed.
The Pre/Post option is set to run ON the backupexec server
This is a trial version of Backup Exec 2010 I am using.
The Backup exec services are either using "local System, or an Administrator account" so permissions shouldn't be the problem

We need to backup the oracle database this way because we will not be able to buy Oracle Agents.  We used Arcserve in the past and Arcserve ran the batch files without any problems.  Us purchasing Backup Exec depends on if we can get it to run these batch files that ran with Arcserve.

Thank for any help on this.



1 ACCEPTED SOLUTION

Accepted Solutions

MitchR
Level 6

In general for scheduled tasks, if you're only accessing things on the local computer, "Local system" is probably good enough.  If you're doing anything over the network, you'll need a Domain Account.  Within BackupExec, these pre & post tasks are going to be using whatever account the BackupExec services use on the BE server - which is almost certanly a Domain Admin if you're setup correctly. 

When in doubt, from the Tools menu, select Backup Exec Services, then click on Services credentials.  Use this to change the services to use whatever account you're using for Backup Exec.  If that account is missing some rights, this process will (usually) clean that up.

I'd recommend trying this:
-On the BE server, make a directory  C:\TestBE
-Assign the "Everyone" group "Full" rights to that directory.
-Make a batch file called "C:\TestBE\PreTest.bat", with the following contents
          ECHO Pre Command works OK>C:\TestBE\Pre-OK.txt
-Make a batch file called "C:\TestBE\PostTest.bat", with the collowing contents
          ECHO Post Commans works OK>C:\TestBE\Post-OK.txt
-Make a test backup job (something small), and assign the above two as Pre & Post tasks.
-Run that test job

If this works, then BE is working OK. Your problem is either rights, or a problem with your script.

If there's any way to log the output of your pre & post files (such as pipeing the output with ">"), you should get a better idea of what's going on.  Troubleshooting blindly can be a real pain!


 

 


 

 

View solution in original post

8 REPLIES 8

JoaoMatos
Level 6
Partner
Hi there,
do you have any error?
when you define batch file in pre/post do you define full path? E
e.g "c:\batchfile\stop-oracle.bat"
Did you define a .bat, .cmd or vb sript?

A batch file can be controled with command "errorlevel"

Regards,
JoaoMatos

Ken_Putnam
Level 6
If you logon to the media server as the BackupExec Service Account, do the Pre and Post cmd files execute properly?  If not, sounds like that account does not have the rights to execute them

RCMORE
Level 3
Hello.  Thaks for the replys.  I did specify the full path "c:\backup\shutdown.bat".  I am going to check on the permissions.  Thanks again

MitchR
Level 6
A minor clarifying point - when running, you won't see the DOS window appear at all - even when logged into the console.  They run as a background task. 

Ditto on the "it's a rights issue" suggestion.  Also don't make any assumptions about the current path when it runs - specify the full path to every file accessed inside of the batch file.

RCMORE
Level 3
I Made the changes and the scripts still do not run during the actual backup job.  Is there a particular service that needs to be run under the "Local System" account? 
When I set up the Backupexec server the account that I specified to have the priviledges is the domain Admin account.  I have checked all of the backup exec services and the "Log ON" tab either has the Domain Admin account in there or the "Local System Account".

Again the scripts run fine and the database remotley shuts down and starts back up if I manually run the batch file. I do this when I am logged on as Domain Admin also.

Thanks.

MitchR
Level 6

In general for scheduled tasks, if you're only accessing things on the local computer, "Local system" is probably good enough.  If you're doing anything over the network, you'll need a Domain Account.  Within BackupExec, these pre & post tasks are going to be using whatever account the BackupExec services use on the BE server - which is almost certanly a Domain Admin if you're setup correctly. 

When in doubt, from the Tools menu, select Backup Exec Services, then click on Services credentials.  Use this to change the services to use whatever account you're using for Backup Exec.  If that account is missing some rights, this process will (usually) clean that up.

I'd recommend trying this:
-On the BE server, make a directory  C:\TestBE
-Assign the "Everyone" group "Full" rights to that directory.
-Make a batch file called "C:\TestBE\PreTest.bat", with the following contents
          ECHO Pre Command works OK>C:\TestBE\Pre-OK.txt
-Make a batch file called "C:\TestBE\PostTest.bat", with the collowing contents
          ECHO Post Commans works OK>C:\TestBE\Post-OK.txt
-Make a test backup job (something small), and assign the above two as Pre & Post tasks.
-Run that test job

If this works, then BE is working OK. Your problem is either rights, or a problem with your script.

If there's any way to log the output of your pre & post files (such as pipeing the output with ">"), you should get a better idea of what's going on.  Troubleshooting blindly can be a real pain!


 

 


 

 

RCMORE
Level 3
Thanks MitchR.  I am going to try this out.
Greatly appreciate the help.

RCMORE
Level 3
Success!!!

Database shut down and backed up last night.  Must of been a combination of making the permissions of the scripts to "everyone" and redoing the services permissions. 

I VERY MUCH appreciate everyones' time spent on this especially "MitchR". 
Thanks a bunch again.