http://www.sqlservercentral.com/blogs/dugi/2010/06/23/stop-n-start-sql-services-via-command-prompt/

Printed 2014/10/02 04:06AM

Stop'n'Start SQL Services via command prompt (cmd)

By Dukagjin Maloku, 2010/06/23

Using the command prompt for stopping and starting services is a very nice possibility and very fast! We know that SQL Server services must never stop, especially the SQL Server core engine service. During the system maintenance sometimes we need to restart the processes and it can be done also with cmd, but at the first we must stop them then start them again, and the restart process will happened! The correct way how to do it with cmd is:

NET STOP <ServiceName>
NET START <ServiceName>

Usually, the name of the service can be the default name of the service like MSSQLServer or can be a named service like MSSQL$InstancedName. However if you want to know the exact what you are trying to do, you can check the service name from regedit @ this location:

HKEY_LOCAL_MACHINE - SYSTEM - CurrentControlSet - services - MSSQLServer

The list of the available SQL Server services after successful install of the SQL Server with all services are:


An example:

Restarting the core engine of the SQL Server:

NET STOP MSSQLAGENT
NET STOP MSSQLSERVER

then

NET START MSSQLSERVER
NET START MSSQLAGENT

In the given example above, I have stop the SQL Agent service name first, why!? - the reason is that the SQL Server Agent Service si connected with core SQL Server Service. You can see, if you restart the SQL Server while the SQL Agent Server is running you will prompted to restart also the SQL Agent Service! So, in this case you should stop the SQL Agent first then SQL Server, then starting them again!

SQL Express Edition:

In SQL Server Express we have the same situation like Named Instance of the SQL Server, so if you want to restart the service you must do like this:

NET STOP MSSQL$SQLEXPRESS
NET START MSSQL$SQLEXPRESS

 ~~~ Stay Tuned!


Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.