Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a command line or even through the sql server studio to gracefully stop SQL Server 2005?

share|improve this question
add comment

4 Answers

up vote 3 down vote accepted

As mfinni said, net stop mssqlserver or similar will do it from the command line. To add to that, from the GUI in SSMS, you can right click the instance name and hit "Stop".

You can also stop/start/restart SQL from the SQL Configuration Manager application.

share|improve this answer
    
Just to be clear, this is a gentle friendly stop, meaning no data loss, all files are left in a consistent way? –  Knox Feb 16 '10 at 20:17
    
Yes, issuing a net stop command initiates a graceful shut down of the service. –  joeqwerty Feb 17 '10 at 2:01
add comment

You can also use Stop-Service -Force -Name 'MSSQL$SQLEXPRESS' if you want it in PowerShell. Substitute MSSQL$SQLEXPRESS with your SQL Server instance name.

share|improve this answer
1  
Thank you for the powershell suggestion. If I do any scripting I generally use Powershell. But I'm not sure if I want to FORCE it to stop. I want to gently let it finish up whatever it's doing with no data lost and all files consistent. –  Knox Feb 16 '10 at 20:16
    
So don't use -Force –  mfinni Feb 16 '10 at 20:28
    
Well then you should stop all dependent services before running it. net stop would do this automatically, powershell won't. I used force just to stop those dependent services as well. –  Parsa Feb 17 '10 at 2:53
add comment

If yout server on windows you can use command from cmd: SC STOP SERVICENAME and SC START SERVICENAME

ServiceName - you can resolve by SC commnad, or look in Services (Control Panel)

Example: SC STOP MSSQL$SQLEXPRESS

share|improve this answer
add comment
net stop <servicename>

Will do it. The servicename will depend on whether it's the default instance or named. Run net start to see what your currently-running services are named.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.