Discussion Locked

SQL Services

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm attempting to get a schedule to stop and start the services on our SQL server so that the backup at night doesn't skip the database.

Any Ideas? Help

5 replies

by joseph moore

Make a BAT file (call it STOP.BAT) that contains the following single line in text:

NET STOP MSSQLSERVER

And then make a 2nd BAT file (call it START.BAT) that reads the following:

NET START MSSQLSERVER

Schedule the Stop file to run before your backup runs. When your backup should be done, then schedule the Start file to run.

hope this helps

by jmiller1

Take note that stopping the MSSQLServer service will also stop the SQLServerAgent service. You will need to restart this service as well. A better strategy is to backup your databases from within SQL Server (Using the 'BACKUP DATABASE' statements)and letting your nightly backup pick up these files. This will eliminate server downtime, and in the event your server crashes, you will be able to restore the databases using 'RESTORE DATABASE', rather than stored procedures to re-attach the database (which can create problems if the server is not shut down properly in case of a crash). Hope that helps!

This discussion is closed to new replies.