3

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

3

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.

  • 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
2

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.

  • 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
2

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

0
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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