Administering SQL Server

Broadcasting a Shutdown Message

Before you stop an instance of Microsoft® SQL Server™, you can broadcast a message to warn users of an impending shutdown. In the message, you can include the time the instance of SQL Server will be stopped so users can finish their tasks.

To broadcast a shutdown message

Command Prompt

Command Prompt

If SQL Server Enterprise Manager or SQL Server Service Manager is not available, you can stop an instance of SQL Server by issuing a SHUTDOWN command from osql or another query tool.

The SHUTDOWN statement minimizes automatic recovery time when you restart an instance of SQL Server. The SHUTDOWN statement stops an instance of SQL Server in this manner:

  1. Logins are disabled (except for the system administrator login). To see a list of all current users, use the sp_who system stored procedure. For more information, see sp_who.

  2. Transact-SQL statements or stored procedures that are running are allowed to finish. To see a list of all active processes and locks, use the sp_who and sp_lock system stored procedures. For more information, see sp_who and sp_lock.

  3. A CHECKPOINT is performed in every database.

    Note  Issuing the SHUTDOWN WITH NOWAIT statement stops the server immediately. However, it requires more recovery time the next time the server is started because no CHECKPOINT is issued against any databases.

To stop SQL Server immediately

Transact-SQL

See Also

sp_lock

sp_who

SQL Server Service Manager