cancel
Showing results for 
Search instead for 
Did you mean: 

One batch file for many servers

Amaan
Level 6

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! 

1 ACCEPTED SOLUTION

Accepted Solutions

RamNagalla
Moderator
Moderator
Partner    VIP    Certified

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> "

View solution in original post

4 REPLIES 4

RamNagalla
Moderator
Moderator
Partner    VIP    Certified

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> "

MKT
Level 5
Employee Accredited

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
Level 6

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?

RamNagalla
Moderator
Moderator
Partner    VIP    Certified

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.