Tip: Manage SQL Server Services from the Command Line

You can start, stop, and pause SQL Server as you would any other service. On a local system, you can type the necessary command at a standard command prompt. On a remote system, you can connect to the system remotely and then issue the necessary command. To manage the default database server instance, use these commands:
NET START MSSQLSERVER Starts SQL Server as a service.
NET STOP MSSQLSERVER Stops SQL Server when running as a service.
NET PAUSE MSSQLSERVER Pauses SQL Server when running as a service.
NET CONTINUE MSSQLSERVER Resumes SQL Server when running as a service.

To manage named instances of SQL Server, use the following commands:
NET START MSSQL$instancename Starts SQL Server as a service, where instancename is the actual name of the database server instance.
NET STOP MSSQL$instancename Stops SQL Server when running as a service, where instancename is the actual name of the database server instance.
NET PAUSE MSSQL$instancename Pauses SQL Server when running as a service, where instancename is the actual name of the database server instance.
NET CONTINUE MSSQL$instancename Resumes SQL Server when running as a service, where instancename is the actual name of the database server instance.

You can add startup options to the end of net start MSSQLSERVER or net start MSSQL$instancename commands. Use a slash (/) instead of a hyphen (–) as shown in these examples:
net start MSSQLSERVER /f /m
net start MSSQL$CUSTDATAWAREHOUS /f /m

Real World Instead of referencing MSSQLSERVER or MSSQL$instancename, you also can reference the service by its display name. For the default instance, you use "SQL Server (MSSQLSERVER)" with net start, net stop, net pause, and net continue. For a named instance, you use net start "SQL Server (InstanceName)", where InstanceName is the name of the instance, such as net start "SQL Server (CUSTDATAWAREHOUS)". In both usages, the quotation marks are required as part of the command text.

From the Microsoft Press book Microsoft SQL Server 2008 Administrator's Pocket Consultant by William R. Stanek.

Looking for More Tips?

For more SQL Server Tips, visit the TechNet Magazine SQL Server Tips page.

For more Tips on other products, visit the TechNet Magazine Tips index.