Servers are SQL Express - about 160 instances. What I need is to execute various scripts(clean tables, backups etc.) on them automatically several times a day. I do not want to use standard Windows Scheduler, as it sometimes just doesn't work. I am looking for a solution maybe free maybe not. Free preferably.
-
2Express doesn't come with Agent, which is what you'd normally use, so your options are Batch Scripts or something similar external to SQL Server. Side note, this question will undoubtedly be closed because it isn't about programming so you may want to check our dba.stackexchange.comS3S– S3S2016-11-23 14:04:05 +00:00Commented Nov 23, 2016 at 14:04
-
The question is what tool to use to start this externalGeorge K– George K2016-11-23 14:29:55 +00:00Commented Nov 23, 2016 at 14:29
-
Yes... but it's opinion based and off topic. See #4 here: stackoverflow.com/help/on-topic Your questions should be MCVE, which you can read about here: stackoverflow.com/help/mcveS3S– S3S2016-11-23 14:38:29 +00:00Commented Nov 23, 2016 at 14:38
-
IMO you should preferebly focus on solving problem you descibed as "Windows Scheduler sometimes just doesn't work" instead of searching for workarounds. Batches launched from Windows Scheduler are preferable choice. If there is some problem with them, work on identifying the problem.miroxlav– miroxlav2016-12-31 13:15:16 +00:00Commented Dec 31, 2016 at 13:15
Add a comment
|
1 Answer
I think you will need to run a batch script to get things done.
For the benefit of all, here's a Delete.bat
ECHO Executing Job
ECHO.
PAUSE
sqlcmd -S "london-sql\sqlexpress" -E -Q "exec London.dbo.DeleteAll"
ECHO Job execution Completed
PAUSE
CLS
EXIT
(‘london-sql\sqlexpress’ is the name of the server)
The Load.dat is almost identical, except '"exec London.dbo.LoadAll"'
Call the batch script with Windows Scheduler.
http://www.howtogeek.com/school/using-windows-admin-tools-like-a-pro/lesson2/all/