Scheduling scripts

  • I'm looking at deploying SQL changes via RedGate's SQL Compare, which generates a script and then possibly using RedGate's Multi-Script to deploy the changes to multiple servers and databases.

    BUT, it looks like Multi-Script is an interactive tool. What's the best way to run a script (to multiple servers and multiple databases) at a off-time, like 3am?

  • if the scripts you are referring to are the T-SQL scripts, you can schedule a one off sql server agent job to run the script. in the scheduling section instead of repeating you would make sure to select one time.

    for your multiple servers once you have the job scheduled on one, through SSMS you can generate a creation script of the job then run that on each server.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

  • Can I do the following:

    Setup:

    Create a share on my server

    Add a T-SQL script "UpdateDB" that is empty

    Set up an agent that runs "UpdateDB"

    When I need to deploy scripts:

    Copy scripts in order into the share and call them a, b, c... etc

    Modify UpdateDB to call the scripts in the correct order

    The last script in UpdateDB deletes all scripts except itself and replaces UpdateDB with an empty file.

    Nightly:

    UpdateDB runs

    If any scripts aren't empty, they are processed

    All scripts are replaced with an empty script when complete

    Log files for the agent can hopefully saved somewhere I can review them.

    Downside:

    No rollback capability unless it's build into the UpdateDB script

    Upside:

    Deploying changes is a matter of copying scripts into the share and modifying UpdateDB to call them.

    Would something like this work?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply