SHUTDOWN
Immediately stops Microsoft® SQL Server™.
Syntax
SHUTDOWN [ WITH NOWAIT ]
Arguments
WITH NOWAIT
Shuts down SQL Server immediately, without performing checkpoints in every database. SQL Server exits after attempting to terminate all user processes, and a rollback operation occurs for each active transaction.
Remarks
Unless members of the sysadmin fixed server role specify the WITH NOWAIT option, SHUTDOWN tries to shut down SQL Server in an orderly fashion by:
- Disabling logins (except for members of the sysadmin fixed server role). To see a listing of all current users, execute sp_who.
- Waiting for currently executing Transact-SQL statements or stored procedures to finish. To see a listing of all active processes and locks, execute sp_lock and sp_who.
- Performing a checkpoint in every database.
Using the SHUTDOWN statement minimizes the amount of automatic recovery work needed when members of the sysadmin fixed server role restart SQL Server.
These tools and methods can also be used to stop SQL Server. Each of these performs a checkpoint in all databases. All committed data from data cache is flushed, and then the server is stopped:
- By using SQL Server Enterprise Manager.
- By using net stop mssqlserver from a command prompt.
- By using Services in Control Panel.
- By using SQL Server Service Manager.
If sqlservr.exe was started from the command-prompt, pressing CTRL+C shuts down SQL Server. However, pressing CTRL+C does not perform a checkpoint.
Note The SQL Server Enterprise Manager, net stop, Control Panel, and SQL Server Service Manager methods of stopping SQL Server produce the identical service control message of SERVICE_CONTROL_STOP to SQL Server.
Permissions
SHUTDOWN permissions default to members of the sysadmin and serveradmin fixed server roles, and are not transferable.