This section discusses the following topics:
In single user mode, the application server stops itself when the task is completed. In multiple user mode, the operator stops it by issuing the SQLEND operator command. In both modes, the database files and the trace file (if active) are closed. The SQLEND command is described in the DB2 Server for VSE & VM Operation manual.
The SQLEND command can be entered from the VSE system operator console only. Its format is shown in Figure 27. The ARCHIVE, LARCHIVE, and UARCHIVE parameters are used to initiate archive activities after the database has been shut down, and are discussed in the next section. The NORMAL parameter is used to shut down the database when all work in progress is completed. The QUICK parameter is used to stop all work in progress and shut down immediately. The TRCPURGE parameter is used if you want to purge the contents of the trace buffer at DB2 Server for VSE shut down. You can also specify the DVERIFY parameter to do a directory verification.
Figure 27. SQLEND Operator Command
.-NORMAL---. >>-SQLEND----+----------+---+----------+---+-----------+------->< +-ARCHIVE--+ '-DVERIFY--' '-TRCPURGE--' +-LARCHIVE-+ +-UARCHIVE-+ '-QUICK----' |
The SQLEND command can be set up to enable the operator to take a database or log archive after all DB2 Server for VSE activity has stopped. The following parameters are available for archiving:
Attention: User archive facilities are available for the database, but not the log. Never attempt to use user facilities to archive a log.
The most appropriate time to take an archive is at shutdown, so consider setting up a procedure for periodic SQLENDs with the ARCHIVE, UARCHIVE, or LARCHIVE parameters, as needed.
For both database and log archives, online archives are disruptive to users. Taking archives during SQLEND avoids this disruption. In addition, database archives taken at SQLEND contain data that is consistent, whereas those started by operator ARCHIVE commands or triggered by ARCHPCT typically contain uncommitted or incomplete data, and require information from the log to make the data consistent. (Consistency is not a problem for log archives regardless of when they are taken, because the database manager always waits until all LUWs end before taking the checkpoint on which the log archive is based.)
To determine the best recovery procedures for your installation, see Recovering from DASD Failures that Damage the Database.
If the operator specifies ARCHIVE or UARCHIVE when LOGMODE=Y, the database manager automatically switches the LOGMODE to A. To resume running with LOGMODE=Y, the operator must do a COLDLOG. See Switching Log Modes.
Should you decide not to take an archive at shutdown, specify NORMAL or QUICK. During a normal shutdown, the database manager allows all active LUWs to finish before ending. During a quick shutdown, the application server ends immediately: in-progress LUWs receive a negative SQLCODE and are rolled back the next time the application server is started.
Note: | A User Archive will NOT be consistent if it is taken following an SQLEND QUICK shutdown. |
If you are running with LOGMODE=L, and request a database archive, and if there is data in the log, then the database manager takes a log archive before taking the database archive. This log archive is written to tape.
Database archives are written to tape. When running a database archive, the database manager displays external label information for you to write on the tape. It then requests that you mount the required tape volumes. See Archiving Procedures for more information.
When the SQLEND command is issued with the NORMAL, ARCHIVE, LARCHIVE, or UARCHIVE parameters, a shutdown is not initiated until all users are disconnected from the application server. The database manager displays a message showing how many agents are still active. (An agent is an internal representation for a user.) As each agent becomes inactive, another message is displayed with an updated count.
The initial count displayed in the message includes all active user agents. When users who are inactive (not allocated to a real agent) disconnect from the database manager, no message is displayed to indicate a reduction in agents; the message is issued only when a user disconnects from the database manager while still allocated a real agent. This results in gaps in the updated count messages.
After issuing an SQLEND command, and before shutdown commences, the operator can issue a SHOW ACTIVE command to find out who is still using the database manager. Users who are connected with no active LUW can prevent the database manager from performing shutdown operations. For example, an ISQL user can end an LUW and then leave the terminal without exiting from ISQL. To determine whether inactive users are preventing
the shutdown operation, use the SHOW USERS operator command to determine which users are still active. For more information on the SHOW commands, see the DB2 Server for VSE & VM Operation manual.
If the SQLEND command is issued with the QUICK parameter, all in-progress work ends and return code 508 is displayed on the console. This command can be issued at any time, even following an SQLEND issued with another parameter.
The DVERIFY parameter determines whether the database manager checks for inconsistencies in the directory. It can be specified with the other parameters, but is ignored if you specify QUICK. It should be specified each time the database is archived (using either DB2 Server for VSE or user facilities); if it is not, any inconsistency in the directory will be recorded in the database archive, so a subsequent restore operation using that archive would fail.
Even if you have not requested a database archive, you should periodically verify the directory (perhaps every few days, depending on the volume of update activity). Otherwise, inconsistencies may surface later. For example, an inconsistency can cause an abnormal end during checkpoint processing. Early detection reduces data loss.
If an error is found in the directory, a message is displayed. If this happens, and you had specified ARCHIVE, the archive is not taken. If you had specified UARCHIVE (a database archive using user facilities), then when you are prompted to take the archive, do not do so. However, if you had specified LARCHIVE, the log archive is taken; the inconsistency in the directory does not affect the log, so the log archive is still valid. For information on recovering from directory verification errors, see the DB2 Server for VSE & VM Diagnosis Guide and Reference manual.
If you are supporting an online (CICS) environment, you should stop the online support before ending the application server, in order to clean up CICS transaction processing efficiently. To stop the online support, enter the CIRR or CIRT transaction. For more information on the effect of a shutdown on online applications, see Stopping the Online Support -- The CIRT Transaction and Removing Connections -- The CIRR Transaction.
Note: | For DB2 Server for VSE, each link from the Online Support requires a dedicated agent, whether or not these agents are actually active. SQLEND NORMAL will not terminate these connections. |