You can stop the application server when in multiple user mode by issuing the SQLEND operator command.
In single user mode, the application server stops after the application terminates, and displays informational messages. In all situations, the database manager closes the database:
The syntax of the SQLEND command is as follows:
.-NORMAL-------------. >>-SQLEND----+--------------------+---+----------+--------------> +-ARCHIVE--+------+--+ '-DVERIFY--' | '-FULL-' | +-LARCHIVE-----------+ +-UARCHIVE-----------+ '-QUICK--------------' >-----+-----------+-------------------------------------------->< '-TRCPURGE--'
|
Note: | New users refers to users who are not currently connected to the application server. Whether active or not, both types of users are classified as existing or current users. (NORMAL is the default.) |
If LOGMODE=Y, the application server automatically switches to LOGMODE=A to create the database archive. To continue to run with LOGMODE=Y, you must do a COLDLOG to switch back to LOGMODE=Y from LOGMODE=A.
You can specify UARCHIVE regardless of the LOGMODE setting. If LOGMODE=L, the database manager archives the log before ending if there is information in the log.
If LOGMODE=Y, the database manager automatically switches to LOGMODE=A to prepare for the user archive. To continue to run with LOGMODE=Y, you must do a COLDLOG to switch back to LOGMODE=Y from LOGMODE=A.
The application server displays a message if it finds an error in its directory. If there is an error, and you have specified ARCHIVE, the application server does not archive the database. If you specified ARCHIVE and LOGMODE to be set to L, the database manager does the log archive if there is information in the log, but does not do the database archive.
When you specify LARCHIVE, and there are discrepancies in the directory, the database manager does the log archive anyway, because the discrepancies are in the directory, not the log.
If you specified UARCHIVE and there is an error in the directory, do not archive the database. (A message reminds you not to do the archive.) If LOGMODE is set to L when you specify UARCHIVE, the database manager archives the log if there is information in the log. Refer to the DB2 Server for VSE & VM Diagnosis Guide and Reference for information on recovering from directory errors.
The following table summarizes archive activity at shutdown based on the
SQLEND parameters and the LOGMODE setting. See Archiving the Database for an explanation of logmodes N, Y, L, and A.
Figure 7. Summary of Archives Done at Shutdown
SQLEND Parameter | Logmode | |||||
---|---|---|---|---|---|---|
N | Y | L | A | |||
NORMAL | Not applicable | None | None | None | ||
QUICK | Not applicable | None | None | None | ||
ARCHIVE | Not applicable | The database manager archives the database. 1, 2, 3 | The database manager does a log archive if there is information in the log, and then does a database archive. 1, 3 | The database manager archives the database. 1, 3 | ||
LARCHIVE | Not applicable | You cannot specify LARCHIVE when LOGMODE=Y. (An error message is displayed.) | The database manager does a log archive. | You cannot specify LARCHIVE when LOGMODE=A. (An error message is displayed.) | ||
UARCHIVE | Not applicable | The operator archives the database after shutdown. 1, 2 | The database manager does a log archive if there is information in the log; then the operator archives the database after shutdown. 1 | The operator archives the database after shutdown. 1 | ||
|
Because NORMAL, ARCHIVE, LARCHIVE, and UARCHIVE let users complete their work, a delay occurs before the application server ends. After entering SQLEND with one of these keywords, you can enter the SHOW USERS command to determine who is still using the application server. The SHOW USERS command is described on page ***.
When you specify ARCHIVE or LARCHIVE (or UARCHIVE with LOGMODE=L), the database manager writes information to tape, unless you are in a VM environment and you are taking a log archive to disk. After all database manager activity stops, the database manager then requests that you mount the required tape volume(s) to store the archive. At the same time, it displays information that you can use to label the tape externally.
In VM only, when the database manager prompts you to mount and prepare the archive volume, respond with the virtual device number. Unless you have entered your own CMS FILEDEF command before starting the application server, the virtual device number for database archives is 181. The default virtual device number for log archives is 183. If you are taking a log archive to disk, you do not have to know the virtual device number. You can direct the archive to disk during the log archive, or change the FILEDEF command for the log archive file before starting the application server. For information on directing the log archive to disk, see your system administrator, or refer to the description of archiving procedures in the DB2 Server for VM System Administration.
When you enter SQLEND NORMAL, ARCHIVE, LARCHIVE, or UARCHIVE, the application server displays a message that indicates the number of agents or agent structures still active. An agent structure is the internal representation for a user. As agents become inactive, the application server issues another message with an updated count.
If you do a quick stop using the SQLEND QUICK command, the application server immediately inactivates all agents and agent structures. It then displays return code 508. You can enter an SQLEND QUICK command at any time, even after issuing an SQLEND with another keyword.