• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

4 SQL scripts, need them run thru multiple DBs on a SQL server weekly

Obsoleet

Platinum Member
What's the best way to do this?

These are the requirements, there are 4 scripts that do database maintenance, I need a script that will run all 4 scripts on each database on the server, then after that is done on 1 DB, it moves along to the next database.. running the 4 scripts on each DB sequentially.

I've looked into built-in SQL maintenance schedules and I think what would be better is some sort of scheduled job I place on the SQL server, and it runs each script sequentially on each DB sequentially that's located on the server.

I need it to be portable, so if we setup a new SQL instance on a server, I can just place the batch file and SQL scripts on the server as a scheduled task, and it will do the work without further customization.

Any ideas or suggestions? Thank you in advance
 
You can use SSIS to execute scripts from disk so that you don't have to go around updating the actual tasks inside SQL Server if you ever update the scripts. Just drop updated versions into the folder on each of your servers.
 
nvm, didn't read the requirements thoroughly.

I'd still like to hear it, because I'm trying to learn new ways to do things, what was your suggestion? Requirements could change slightly in some respects if they are silly/unnecessary and I don't see that. Just looking for the best way in an environment with my SQL servers to have a generic 4 script set run on each DB sequentially.

Don't care how its done as long as I can easily port the setup to a new server quickly.
 
Yeah, I agree with LokutusofBorg, you can set up multiple task in a Sequence container with SSIS without too much trouble.

To implement on a new Server all you'd need to do is just change the Connection Manager.
 
What about creating linked servers on the fly and then executing dynamic sql code against the different servers using values from a parameters table?
 
Back
Top