http://www.sqlservercentral.com/blogs/sqlandme/2013/03/11/sql-server-startstop-sql-server-from-command-line/

Printed 2014/04/20 10:45PM

SQL Server – Start/Stop SQL Server from command line

By Vishal.Gajjar, 2013/03/11

You can start/stop SQL Server services using Services Console or SQL Server Configuration Manager. You can also perform these operation using command line in Windows. For this you must run command prompt with Administrative privileges.

Method 1: Start/Stop SQL Server using NET command:

You can start/stop SQL Server from command line using NET command as below:

NET Action Service Name or Service Display Name

Where Action can be Start or Stop, and you can either specify Service Name or Service Display Name. Service Name is actual name which is registered as service and Service Display Name is a Descriptive Name for Service. For example, for default instance of SQL Server Service Name is "MSSQLSERVER", and Service Display Name is "SQL Server (MSSQLSERVER)". Below is a screenshot of Service Properties to explain this:

image

 

To START SQL Server Service, use:

NET start MSSQLSERVER

OR

NET start "SQL Server (MSSQLSERVER)"

 

To STOP SQL Server Service, use:

NET stop MSSQLSERVER

OR

NET stop "SQL Server (MSSQLSERVER)"

 

Method 2: Start/Stop SQL Server using SC command line utility:

The main advantage of using SC utility to start services is you can specify startup parameters while starting a service:

You can start/stop SQL Server from command line using SC utility as below:

SC Action Service Name or Service Display Name [Optional Parameters]

 

To START SQL Server Service, use:

SC start MSSQLSERVER

OR

SC start "SQL Server (MSSQLSERVER)"

To START SQL Server Service with parameters, use:

SC start MSSQLSERVER -m

OR

SC start "SQL Server (MSSQLSERVER)" -m

* The -m switch starts SQL Server in single user mode.

To STOP SQL Server Service, use:

SC stop MSSQLSERVER

OR

SC stop "SQL Server (MSSQLSERVER)"

Hope This Helps!

Vishal

If you like this post, do like my Facebook Page -> SqlAndMe
EMail me your questions -> Vishal@SqlAndMe.com
Follow me on Twitter -> @SqlAndMe


Filed under: SQL Configuration, SQLServer, SQLServer 2005, SQLServer 2008, SQLServer 2008 R2, SQLServer 2012, Undocumented Functions
Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.