How to refresh database parallelly on sql server

来源:互联网 发布:安卓自学 知乎 编辑:程序博客网 时间:2024/05/16 12:23

Today. I've got a job to refresh database parallelly where possiable on multiple sql server.

 

I never did this job before. normally. we did this one by one(the one start must wait for the previous one completed) like use WHILE statements. but our databases is large( about 200 gb). so it's not better way to do that(the one is progress, the rest is doing nothing).

 

How should I do?

I think it should be scheduled. so I found this command at.exe to schedule a .bat/program.

 

 

at first, create a .cmd file to hold you command used to refresh database.

 

e.g. create a .cmd file called refreshdb.cmd

the file contains the following codes

@echo off

sqlcmd -S myserver -E -h -1 -l 8 -Q "restore database mydb from disk='d:/mydb.bak';">c:/refreshdb.txt

delete -f refreshdb.cmd

 

 

second, use at.exe to schedule the .cmd file

e.g. at //mypc 10:15 d:/refreshdb.cmd

 

if add a job successfully. you can use at.exe to list all jobs.

 

 

 

 

原创粉丝点击