Shuts down the Adaptive Server from which the command is issued, its local Backup Server, or a remote Backup Server.
shutdown [srvname] [with {wait [="hh:mm:ss"] | nowait}]]
is the logical name by which the Backup Server is known in the Adaptive Server sysservers system table. This parameter is not required when shutting down the local Adaptive Server.
is the default. This shuts down the Adaptive Server or Backup Server gracefully.
is an optional setting that specifies the maximum time the server waits for all running or sleeping processes to finish their job.
shuts down the Adaptive Server or Backup Server immediately, without waiting for currently executing statements to finish.
Use of shutdown with nowait can lead to gaps in IDENTITY column values.
Shuts down the Adaptive Server from which the shutdown command is issued:
shutdown
Shuts down the Adaptive Server immediately:
shutdown with nowait
Shuts down the local Backup Server:
shutdown SYB_BACKUP
Shuts down the remote Backup Server REM_BACKUP:
shutdown REM_BACKUP
Unless you use the nowait option, shutdown attempts to bring Adaptive Server down gracefully by:
Disabling logins (except for the System Administrator)
Performing a checkpoint in every database
Waiting for currently executing SQL statements or stored procedures to finish
Shutting down the server without the nowait option minimizes the amount of work that must be done by the automatic recovery process.
Unless you use the nowait option, shutdown backup_server waits for active dumps and loads to complete. Once you issue a shutdown command to a Backup Server, no new dumps or loads that use this Backup Server can start.
Use shutdown with nowait only in extreme circumstances. In Adaptive Server, issue a checkpoint command before executing a shutdown with nowait.
You can halt only the local Adaptive Server with shutdown; you cannot halt a remote Adaptive Server.
You can halt a Backup Server only if:
It is listed in your sysservers table. Use sp_addserver to add entries to sysservers.
It is listed in the interfaces file for the Adaptive Server where you execute the command.
Use sp_helpserver to determine the name by which a Backup Server is known to the Adaptive Server. Specify the Backup Server’s name— not its network_name—as the srvname parameter. For example:
sp_helpserver
name network_name status id ---------- ------------- ------------------------------------ -- REM_BACKUP WHALE_BACKUP timeouts, no net password encryption 3 SYB_BACKUP SLUG_BACKUP timeouts, net password encryption 1 eel eel 0 whale whale timeouts, no net password encryption 2
To shut down the remote Backup Server named WHALE_BACKUP, use:
shutdown REM_BACKUP
When the server prepares to down, it:
Performs checkpoint on all the databases
Prevents any new user from logging in
Waits for all running or sleeping processes to finish their job
Performs another checkpoint on the databases, this time with a flag that informs you that you need to flush:
All the dynamic thresholds in mixed log-data databases
All the object statistics
The values of the identity fields to avoid holes after recovery
When you use with wait with the hh:mm:ss option, the time you specify is not the meximum total time Adaptive Server takes to shut itself down. Instead, Adaptive Server takes into account the time it takes to perform the first checkpoint, and automatically subtracts this from the time you specified.
For example, if you specify a maximum wait time of 20 minutes and the first checkpoint takes 3 minutes, Adaptive Server allows up to 17 minutes for the processes to finish. If for some reason the second checkpoint takes longer, however, this is not calculated into the with wait hh:mm:ss parameter you specify.
Adaptive Server also accommodates a checkpoint that takes longer than the time you specify in with wait hh:mm:ss. For example, if you specify a wait time of 10 minutes but the first checkpoint takes 20 minutes to complete, Adaptive Server does not interrupt checkpoint midway, but instead waits for checkpoint to complete. When this occurs, Adaptive Server immediately begins to shut down after checkpoint is complete, since the time you specified has passed, and runs the last checkpoint with the flag informing you of the flushes you must perform.
ANSI SQL – Compliance level: Transact-SQL extension.
shutdown permission defaults to System Administrators and is not transferable.
Values in event and extrainfo columns of sysaudits are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
51 |
security |
Server shutdown |
|
Commands alter database
System procedures sp_addserver, sp_helpserver