Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 3.87 KB

File metadata and controls

80 lines (58 loc) · 3.87 KB
title SHUTDOWN (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service sql-database
ms.reviewer
ms.technology t-sql
ms.topic language-reference
f1_keywords
SHUTDOWN_TSQL
SHUTDOWN
dev_langs
TSQL
helpviewer_keywords
SQL Server, stopping
shutting down SQL Server
SHUTDOWN statement
stopping SQL Server
immediately stopping SQL Server
ms.assetid c8b03ff9-688c-4fe8-86e8-bd6bd401c9a4
author rothja
ms.author jroth

SHUTDOWN (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-md]

Immediately stops SQL Server.

Topic link icon Transact-SQL Syntax Conventions

Syntax

  
SHUTDOWN [ WITH NOWAIT ]   

Arguments

WITH NOWAIT
Optional. Shuts down [!INCLUDEssNoVersion] without performing checkpoints in every database. [!INCLUDEssNoVersion] exits after attempting to terminate all user processes. When the server restarts, a rollback operation occurs for uncompleted transactions.

Remarks

Unless the WITHNOWAIT option is used, SHUTDOWN shuts down [!INCLUDEssNoVersion] by:

  1. Disabling logins (except for members of the sysadmin and serveradmin fixed server roles).

    [!NOTE]
    To display a list of all current users, run sp_who.

  2. Waiting for currently running Transact-SQL statements or stored procedures to finish. To display a list of all active processes and locks, run sp_who and sp_lock, respectively.

  3. Inserting 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 [!INCLUDEssNoVersion].

Other tools and methods can also be used to stop [!INCLUDEssNoVersion]. Each of these issues a checkpoint in all databases. You can flush committed data from the data cache and stop the server:

  • By using [!INCLUDEssNoVersion] Configuration Manager.

  • By running net stop mssqlserver from a command prompt for a default instance, or by running net stop mssql$instancename from a command prompt for a named instance.

  • By using Services in Control Panel.

If sqlservr.exe was started from the command prompt, pressing CTRL+C shuts down [!INCLUDEssNoVersion]. However, pressing CTRL+C does not insert a checkpoint.

Note

Using any of these methods to stop [!INCLUDEssNoVersion] sends the SERVICE_CONTROL_STOP message to [!INCLUDEssNoVersion].

Permissions

SHUTDOWN permissions are assigned to members of the sysadmin and serveradmin fixed server roles, and they are not transferable.

See Also

CHECKPOINT (Transact-SQL)
sp_lock (Transact-SQL)
sp_who (Transact-SQL)
sqlservr Application
Start, Stop, Pause, Resume, Restart the Database Engine, SQL Server Agent, or SQL Server Browser Service