Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Shutting down SQL server before a  powerfailure

Posted on 2001-09-05
4
Medium Priority
?
409 Views
Last Modified: 2008-02-26
I have a UPS software which allows me to run a script (.bat) in NT/Windows 2000 just before shutting down windows in the event of a power failure.

1. If I shut down windows without bringing MSSql down, does it cause problems? Or is SQL brought down safely by NT itself before shutting down?

2. What command can I use in the batch file to bring down SQL safely?
0
Comment
Question by:raj_nbr
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 6459696
Normally, SQL Server runs as a service, and is requested by Windows to shutdown whenever windows goes down...
Now if you want to stop SQL Server by bat file, simply put this command:
NET STOP MSSQLSERVER

This will stop all the services related to SQL Server too:
MS SQL Server agent, for example, and any other service that marked sqlserver as dependency

Cheers
0
 

Expert Comment

by:racosta
ID: 6460577
If the SQLServerAgent is started, and you execute NET STOP MSSQLSERVER, it's gonna ask you to also shutdown the SQL Server Agent service, but if the process is in background, you wont'n be able to answer the question and it won't work.
  First execute NET STOP SQLSERVERAGENT (if it is already sttoped it will give an error but it will continue) and then NET STOP MSSQLSERVER.

   But the Server it selfs shutdowns all the services before a normal shutting down. If a power failure happens, then the server won't shutdown ok, but when it raise up, rolls back all the uncommited transactions and rolls forward all the commited transactions.
 
  In this way, every finished transaction is like it was before power failure, and all the transactions that where running when the power failure happens, is like they never happened.

   
0
 
LVL 3

Author Comment

by:raj_nbr
ID: 6769186
This comment being the first one, gets selected.
0
 

Expert Comment

by:prjordan
ID: 8082661
would

NET START SQLSERVERAGENT
NET START MSSQLSERVER

get SQL back up running after it was stopped without a restart of the computer?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question