+ Post New Thread
Results 1 to 5 of 5
Windows Thread, Stopping SQL using a Bat file in Technical; Hi at the momment we have a bat file that runs just before backup starts so it can stop our ...
  1. #1
    ful56_uk's Avatar
    Join Date
    Mar 2008
    Location
    Essex
    Posts
    534
    Thank Post
    104
    Thanked 23 Times in 21 Posts
    Rep Power
    17

    Stopping SQL using a Bat file

    Hi

    at the momment we have a bat file that runs just before backup starts so it can stop our sims sql database. I have notice that it has stopped working becuase the file askes a questions do you really want to do this because it is connected to sql server agent.

    My question is what command do I put in the bat file to auto answer Yes to this question if it comes up again.

    Mark

  2. #2

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    If you give us a clue what's in the batch file we might be able to give a better answer :-)

    I'm guessing you've got something like "net stop mssqlserver" - if so, then you want "net stop mssqlserver /y"

    I'm assuming that you're just backing up the mdf/ldf files - you can do this but it's much better to use SQL's built in backup routines to backup the db and then back up the files it generates - exclude the "data" folder from your normal backup. Working like this means you don't have to stop the SQL server (may not matter for SIMS if you're doing it over night) but also means you can do things like flushing the transaction logs.

    There have been threads on here before about the best way to backup SIMS - worth checking them out.

  3. #3
    ful56_uk's Avatar
    Join Date
    Mar 2008
    Location
    Essex
    Posts
    534
    Thank Post
    104
    Thanked 23 Times in 21 Posts
    Rep Power
    17
    Cheers, thats the info i need, yeah it runs over night, ill add the /y to the file seems the way. Not very good with sql so i wouldnt know what to do with sqls own backup routines.

    Thanks for your help

    Mark

  4. #4

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,374
    Thank Post
    625
    Thanked 951 Times in 653 Posts
    Blog Entries
    2
    Rep Power
    318
    Speaking from experience, I would also set a separate script to run every morning before people get in to work to re-start the SQL - just incase the backup script fails for whatever reason leaving the SQL in a stopped state.

  5. #5
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,938
    Thank Post
    114
    Thanked 272 Times in 250 Posts
    Rep Power
    104
    Quote Originally Posted by webman View Post
    Speaking from experience, I would also set a separate script to run every morning before people get in to work to re-start the SQL - just incase the backup script fails for whatever reason leaving the SQL in a stopped state.
    I would second that suggestion. We had a problem with the backup being too big sometimes and the server would just be stuck on the backup until I fixed it. I made sure SQL had started by 7 am after that.

SHARE:
+ Post New Thread

Similar Threads

  1. Stopping Outlook Rules
    By BKGarry in forum How do you do....it?
    Replies: 6
    Last Post: 15th January 2008, 08:45 AM
  2. Who is stopping up then?
    By russdev in forum General Chat
    Replies: 13
    Last Post: 7th January 2008, 08:42 PM
  3. Services Stopping
    By edsa in forum Windows
    Replies: 2
    Last Post: 10th July 2007, 10:58 AM
  4. Replies: 4
    Last Post: 23rd March 2006, 06:27 AM
  5. Stopping RSS Nags
    By dagza in forum Mac
    Replies: 6
    Last Post: 22nd December 2005, 07:07 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •