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:
- Core engine =
MSSQLSERVER (default instance) or MSSQL$InstanceName (Instance Name)
- SQL
Agent = SQLSERVERAGENT (default instance) or SQLAGENT$InstanceName
(Instance Name)
- SSRS = ReportServer
- SSIS =
MsDtsServer100 (SQL Server 2008), MsDtsServer (SQL Server 2005)
- SSAS = MSSQLServerOLAPService
- SQL
Browser = SQLBROWSER
- Full-Text = MSSQLFDLauncher
- SQL
Server VSS Writer = SQLWRITER
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!