Stopping SQL Server

Administering SQL Server

Administering SQL Server

Stopping SQL Server

You can stop an instance of Microsoft® SQL Server™ locally from the server or remotely from a client or another server. If you stop an instance of SQL Server without pausing it, all server processes are terminated immediately. Stopping an instance of SQL Server prevents new connections and disconnects current users.

The following table describes the available methods for stopping an instance of SQL Server.

Method Description
SQL Server Enterprise Manager Stops a local or remote instance of SQL Server or a SQL Server Agent service.
SQL Server Service Manager Stops a local or remote instance of SQL Server or a SQL Server Agent service from a single window or from the Windows® taskbar.
SHUTDOWN statement Stops an instance of SQL Server when executed within osql or another query tool. Using the WITH NOWAIT option stops an instance of SQL Server immediately.
net stop mssqlserver Stops an instance of SQL Server either remotely or locally if you are running the Microsoft Windows NT® 4.0 or Windows® 2000 operating systems. To stop a named instance of SQL Server 2000, you must enter net stop mssql$instancename from the command prompt.
Control Panel Stops an instance of SQL Server using the Services application in Control Panel.
CTRL+C Stops an instance of SQL Server if it was started as a program from the command prompt.

When you stop an instance of SQL Server, the server performs these services before it shuts down:

  • Disables logins (except for system administrators).

  • Performs a CHECKPOINT in every database. However, if you stop an instance of SQL Server using CTRL+C at the command prompt, it does not perform a CHECKPOINT in every database. Therefore, the next time the server is started, recovery time takes longer.

  • Waits for all Transact-SQL statements or stored procedures currently executing to finish.

Note  To bring the system to an immediate halt, you can issue the SHUTDOWN WITH NOWAIT statement from the osql utility.

To stop SQL Server