Video Screencast Help

One batch file for many servers

Created: 15 Jan 2013 • Updated: 31 Jan 2013 | 4 comments
This issue has been solved. See solution.

Hi, Configuring backup for SQL databases and would like to know if it is possible to modify the batch files and put all databases from 2-3 servers into one batch file and run it. Will it get successful?

NBU: 7.0.1

Windows 2008R2

Thanks! 

Comments 4 CommentsJump to latest comment

Nagalla's picture

I dont think its possible.

you would need to have the batch file on the same sever where your data base is running.

based on the sever your script parameters also change.

you can use

DATABASE $ALL 

in all the scripts as a common parameter.

but you need to specify the correct parameters for below.

SQLHOST " <hostname> "

BROWSECLIENT " <hostname> "

SOLUTION
MKT's picture

That is correct, the batch file is local to each server so if you use the same name:

alldatabase.bch

you use that name in a backup policy for all three servers but the local file needs to have the correct SQLHOST connection string.

Amaan's picture

If each server has its own batch file with the smae name. they all will have their own server name in the batch file. For example:

i ahve servers: Server1, Server2 and Server3 and when i create batch files on each server sepearatly they will ahve something like:

Database $All

SQLserver - server1 for batch file which is on the server1 \dbext\MSSQL folder

SQLserver - server2 in the batch file which is on the server2 and etc

this shoudl not make any problem. Does anybody have similar configurations?

Nagalla's picture

Amaan,

yes, there are many servers, having more than one data base,  you can make them backup with single bch file avaliable locally.

that does not make any problems.

you can safely go ahead and test it.