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 ...
6th April 2008, 09:36 PM #1
Stopping SQL using a Bat file
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.
6th April 2008, 09:41 PM #2
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.
6th April 2008, 09:55 PM #3
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
6th April 2008, 10:30 PM #4
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.
7th April 2008, 12:09 AM #5
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.
Originally Posted by webman
By BKGarry in forum How do you do....it?
Last Post: 15th January 2008, 08:45 AM
By russdev in forum General Chat
Last Post: 7th January 2008, 08:42 PM
Last Post: 10th July 2007, 10:58 AM
By tosca925 in forum Scripts
Last Post: 23rd March 2006, 06:27 AM
Last Post: 22nd December 2005, 07:07 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)