Solved

Shutting down SQL server before a  powerfailure

Posted on 2001-09-05
4
402 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 100 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

733 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