SAND CDBMS SQL Reference Guide
SHUTDOWN

 

The SHUTDOWN command is used to stop a database server engine (nserv) running a database instance. When the server is shut down, no connections can be made to the database instance until it is restarted. If the database instance is running in Virtual Mode, the SHUTDOWN command can be used to make permanent changes to the database. If the database instance is running in Persistent (Time Travel) Mode, the SHUTDOWN command can be used to save the changes to an Update File, which will represent a new version or Snapshot of the database.


Required Privileges

To execute the SHUTDOWN command, the user authorization must possess DBA privileges.


Syntax


IMMEDIATE
The IMMEDIATE keyword specifies that the server should be shut down immediately. All currently connected users will be disconnected and any uncommitted transactions automatically rolled back. This is the default option; SHUTDOWN by itself is the same as SHUTDOWN IMMEDIATE.

DEFERRED
The DEFERRED keyword specifies that the server should be shut down as soon as the connected user count drops to zero (that is, when all users have disconnected from the database).

KEEP CHANGE
If the database is running in Virtual Mode and it is the master instance, a KEEP CHANGE argument can be optionally specified to save the changes to the real database. If the database is running in Persistent Mode, the KEEP CHANGE argument can be used to create a new version or Snapshot of the database, which will incorporate all of the changes.

Note:
If the KEEP CHANGE argument is applied in Persistent Mode, a ‘change-file’ parameter should not be included. The resulting Update File is automatically given the same name as the database, with the extension .Uxx (where xx is a hexadecimal number that increases incrementally with each update), and is saved in the same directory as the primary database file.

Refer to the SAND CDBMS Administration Guide for further information about saving changes in Virtual Mode and Persistent Mode.

'change-file'
A 'change-file' name may be included in Virtual Mode, with or without a file path, to give a user-defined name to the Update File used for the KEEP CHANGE operation. Quotation marks must enclose the Update File path/name. If no file path is given, the Update File will be stored in the directory specified by the DatabasePath parameter in the nucleus.ini section for the instance.

If a name is not provided, the Update File will by default be given the same name as the database, with the extension .Cxx (where xx is the last database checkpoint to which the changes will be applied). Refer to the SAND CDBMS Administration Guide for more information about Virtual Mode Update Files.

SET CURRENT
If the database is running in Persistent Mode, including the SET CURRENT argument after the KEEP CHANGE argument sets the new Snapshot as the default (current) entry point. If SET CURRENT is omitted, whichever Snapshot is current remains current, except when it is the parent of the new Snapshot, in which case the new Snapshot is automatically set as current.


Example

SHUTDOWN DEFERRED KEEP CHANGE 'updtemp';

The above command defers shutdown of the database server process until all users have disconnected from the server. When there are no more user connections, the changes made in Virtual Mode are applied to the actual database through an Update File called 'updtemp.Cxx', stored in the same directory as the primary database file.

The following command, applicable only in Persistent Mode, shuts down the database version and creates a new Snapshot, which is then set as the current or default Snapshot:

SHUTDOWN IMMEDIATE KEEP CHANGE SET CURRENT;