How SHRLEVEL CHANGE works
Processing for SHRLEVEL CHANGE is similar to SHRLEVEL REFERENCE. However, some additional tasks are performed in the UNLOAD and RELOAD phases, and two additional phases occur, LOGAPPLY and LOGFINAL.
The figures in this topic illustrate the data sets that REORG PLUS uses during each phase.
UTILINIT and ANALYZE phases
In the initial phases, a SHRLEVEL CHANGE reorganization is the same as SHRLEVEL REFERENCE. The UTILINIT phase initializes the job, verifies the REORG command and IDCAMS control statements, and performs Db2 catalog lookups. The ANALYZE phase analyzes the objects and optionally produces statistics.
At the beginning of the UNLOAD phase (for a two-phase reorganization), REORG PLUS initializes the XBM interface and, during initialization, prevents update access to all of the tables that are involved in the reorganization. However, for the remainder of the UNLOAD and RELOAD phases, REORG PLUS allows updates to all of the tables. REORG PLUS performs the actual reorganization and rebuilding of indexes on the staging data sets.
At the beginning of the UNLOAD phase, REORG PLUS initializes the interface to the XBM Utility Monitor function. Under certain limited conditions, REORG PLUS turns on Db2 Data Capture Changes, telling Db2 to log the entire row rather than only the changed portion of the row.
REORG PLUS also initializes the log-control tasks, which are specific to SHRLEVEL CHANGE. These tasks capture any changes that the user makes to the table space or the indexes after XBM initialization. REORG PLUS obtains the log record that reflects each change and stores that record in an internal structure in memory. If necessary, this structure spills to disk. You can allocate the amount of memory and disk space by using the options for SHRLEVEL CHANGE.
For a table space reorganization, REORG PLUS creates a RID translation map, which is used in the LOGAPPLY phase to match Db2 log records with the appropriate rows in the newly reorganized object. The RID maps are also stored in data spaces and spill to disk if necessary. You can allocate the amount of RID map memory by using the options for SHRLEVEL CHANGE.
REORG PLUS unloads the table space and index space data. REORG PLUS uses a snapshot of the object that XBM provides for both table space and index space data. Using the snapshot ensures that REORG PLUS reads the original pages (those present when XBM was initialized) rather than pages that contain updates.
For a partial table space reorganization of a partitioned table space where nonpartitioned indexes are defined, REORG PLUS defines the staging data sets and uses XBM to copy the nonpartitioned indexes from the original data sets to the staging data sets in this phase.
For more information about topics discussed in this section, see the following references:
When REORG PLUS turns on Data Capture Changes
DATACAP installation option description
Spill data sets
SHRLEVEL CHANGE options
Performance considerations for the UNLOAD phase
In the RELOAD phase, REORG PLUS performs the same tasks as for SHRLEVEL REFERENCE, including reloading the table space and index space data. REORG PLUS allocates the staging data sets and writes the reorganized data to them, as follows:
REORG PLUS performs this action
Full or partial table space
Loads the table space data into the table space staging data sets
Full table space
Loads the index data into the index staging data sets
Partial table space
Updates the nonpartitioned indexes that REORG PLUS previously copied to the staging data sets
Loads the index data into the index staging data sets
During this phase, REORG PLUS also sorts the indexes and collects statistics. For a table space reorganization, REORG PLUS makes a full image copy of the table space. However, REORG PLUS does not register the copy in the table until the UTILTERM phase. At the end of the RELOAD phase, the staging data sets contain a reorganized version of the original data sets as they appeared when XBM took the snapshot.
For information about performance considerations for the RELOAD phase, see RELOAD phase.
For SHRLEVEL CHANGE, REORG PLUS combines the operations of the UNLOAD and RELOAD phases of a two-phase reorganization into the REORG processing phase for a single-phase reorganization.
When the RELOAD or REORG phase is complete, the LOGAPPLY phase begins. This phase applies the stored log records to the reorganized staging data sets. REORG PLUS continuously monitors parameters and events until it reaches one of the criteria that triggers the LOGFINAL phase, such as reaching the log threshold (as specified with the LOGTHRESHLD option). The criteria are based on the log apply control options that you set in the options module or with the REORG command. For more information, see Controlling the log apply process.
REORG PLUS also provides statistics regarding the progress of the LOGAPPLY phase and the overall reorganization. This information is available through the XBM Utility Monitor interface or the MVS console. In addition to viewing the status of the job, you can dynamically change the settings of any of the log apply control options by using the XBM Utility Monitor interface or the MVS console. For more information, see Using XBM to view and dynamically control the log apply process.
Throughout this phase, REORG PLUS continues to monitor the Db2 log for records that pertain to the objects that you are reorganizing. If the value for ICTYPE is UPDATE, REORG PLUS updates the full copy data sets throughout the LOGAPPLY phase.
During the LOGFINAL phase, REORG PLUS controls access to the original table space and index space objects based on the value that you specify for the DRAIN command option or DRAINTYP installation option, as follows:
Prevents only updates if you specify WRITERS
Prevents all access if you specify ALL
Controlling access stops the arrival of new log records and allows REORG PLUS to finish applying the last of the existing log records to the staging data sets. If required and the table space is partition-by-growth, REORG PLUS adds partitions. Then, depending on the value of ICTYPE, REORG PLUS performs one of the following actions:
Creates incremental copy data sets to record changes made since REORG PLUS created the full copy data sets
Updates the full copy data sets
However, REORG PLUS does not register any copies in SYSIBM.SYSCOPY until the UTILTERM phase.
If Data Capture Changes was turned on in the UNLOAD phase, REORG PLUS turns it off in this phase. In some error conditions, REORG PLUS might not be able to turn off Data Capture Changes. For more information, see Not completing the reorganization before the UTILTERM phase.
Before UTILTERM, REORG PLUS makes changes only to the staging data sets. If a failure occurs, no restart is needed. You can continue using the original data sets as if no reorganization attempt was made. For more information, see Not completing the reorganization in the UTILTERM phase.
After the LOGFINAL phase completes and the UTILTERM phase begins, REORG PLUS prevents any access to the original table space or index space objects and performs either the rename or FASTSWITCH process, as shown in the following table. For more information about the rename and FASTSWITCH processes, see Staging data sets.
REORG PLUS action
This action causes the staging data sets to replace the original data sets.
Bypasses the rename process, and changes the Db2 catalog to point to the staging data sets
If REORG PLUS fails during the rename or FASTSWITCH process, we recommend that you restart the job. If you are unable to restart the job, see Not completing the reorganization in the UTILTERM phase for information about the actions to take next.
REORG PLUS automatically backs out the reorganization when a failure occurs during rename processing and you are reorganizing a catalog object.
If you are using the DDLIN data set to alter limit keys, REORG PLUS reorganizes the data in the partitions based on the new key values and alters the limit keys during the UTILTERM phase, thus rebalancing the data in the partitions. For more information, see DDLIN data set restrictions and considerations.
REORG PLUS registers the full image copy data sets and incremental copy data sets (if incremental copies were created) in the SYSIBM.SYSCOPY table.
After completing the rename or FASTSWITCH process, REORG PLUS allows all access to the objects to resume. REORG PLUS optionally deletes the original data sets or renames them in preparation for a subsequent reorganization. REORG PLUS updates the BMCHIST table and optionally updates the following statistics:
Statistics in the Db2 catalog
DASD MANAGER PLUS statistics tables
When REORG PLUS completes this phase, the reorganization is complete.
Data sets by execution phase
The following figures show the data sets that each execution phase uses during a SHRLEVEL CHANGE reorganization.
Processing phases: SHRLEVEL CHANGE two-phase table space reorganization (part 1 of 2)
Processing phases: SHRLEVEL CHANGE two-phase table space reorganization (part 2 of 2)
Processing phases: SHRLEVEL CHANGE two-phase index reorganization
Processing phases: SHRLEVEL CHANGE single-phase table space reorganization (part 1 of 2)
Processing phases: SHRLEVEL CHANGE single-phase table space reorganization (part 2 of 2)
Log in or register to comment.