-STOP DB2 command (Db2)

The Db2 command STOP DB2 stops the Db2 subsystem.

Abbreviation: -STO DB2

Environment

This command can be issued from a z/OS® console, a DSN session, a DB2I panel (DB2 COMMANDS), an IMS or CICS® terminal, or a program using the instrumentation facility interface (IFI).

Data sharing scope: Member

Authorization

To execute this command, you must use a privilege set of the process that includes one of the following privileges or authorities:
  • STOPALL privilege
  • SYSOPR authority
  • SYSCTRL authority
  • SYSADM authority

Db2 commands that are issued from a logged-on z/OS console or TSO SDSF can be checked by Db2 authorization using primary and secondary authorization IDs. Start of changeA logged-on z/OS user ID must be defined in RACF or a similar security server.End of change

Syntax

Read syntax diagramSkip visual syntax diagramSTOP DB2MODE(QUIESCEFORCE)CASTOUT(YESNO)

Option descriptions

MODE
Indicates whether currently executing programs will be allowed to complete. For the effects of this option on distributed threads see the description of the MODE option of -STOP DDF command (Db2).
(QUIESCE)
Allows currently executing programs to complete processing. No new program is allowed to start. If a utility starts a subtask after -STOP DB2 MODE (QUIESCE) has been issued, message DSNU006I is issued and the subtask and utility might end abnormally.
(FORCE)
Terminates currently executing programs, including utilities. No new program is allowed to start. MODE(FORCE) probably causes indoubt situations. Some tasks, such as stored procedures tasks and Db2 service tasks, terminate abnormally. When they terminate abnormally, you might see dumps and messages from these failures.
CASTOUT
Specifies whether the Db2 member performs castout processing for the page sets or partitions for which the member was last updated. The CASTOUT option only applies in a data sharing environment.
YES
Allow group buffer pool castout processing.
NO
Skip group buffer pool castout processing.

Usage notes

MODE(QUIESCE): If MODE(QUIESCE) is used, all connected address spaces must terminate all connections before the Db2 subsystem stops. The system operator can tell whether any connections remain by using the DISPLAY THREAD command, and can cancel them by using the Db2 CANCEL command or z/OS commands.

MODE(FORCE): A forced stop does not cause an immediate abend. If a connected task is executing outside Db2, Db2 posts an exit routine to stop the task from accessing Db2. If a task is executing in Db2, it stops when the next suspend or execution unit switch occurs. In some cases, the delay before stopping can be significant.

CASTOUT(NO): Consider using CASTOUT(NO) when shutting down a Db2 data sharing member for maintenance, because the option can speed shutdown processing in a data sharing environment. If you are shutting down multiple members of a data sharing group with CASTOUT(NO), some changed data might reside in the group buffer pools after the members have shut down. Therefore, if you want consistent data on disk (for example, you are shutting down all members to create a copy of the database to send offsite), do not use CASTOUT(NO).

With CASTOUT(NO), the Db2 member shuts down with QC status, as displayed by the DISPLAY GROUP command, which indicates that the member quiesced with some castout processing not completed. A retained page set or partition P-lock is held in IX state for each object for which the Db2 member was the last updater. Also, group buffer pool connections enter a failed-persistent state.

Example

Example 1: Stop the Db2 subsystem. Allow currently active programs to complete. Do not allow new programs to identify to Db2.
-STOP DB2 MODE (QUIESCE)
Example 2: Stop a member of a data sharing group for maintenance.
-STOP DB2 MODE (QUIESCE) CASTOUT(NO)