Solved

Shutting down SQL server before a  powerfailure

Posted on 2001-09-05
4
397 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 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
This comment being the first one, gets selected.
0
 

Expert Comment

by:prjordan
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Truncate vs Delete 63 87
Microsoft SQL query 7 38
MS Dynamics AX 2009 2012 Database/Report Optimization 3 26
Report Builder 9 25
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now