Effects of running REORG TABLESPACE
Running the REORG TABLESPACE utility can have effects on version numbers and the version of the data, control intervals, row formats, and table spaces that are defined with the NOT LOGGED attribute.
The effect of REORG TABLESPACE on table space versions
Db2 stores the range of used version numbers in the OLDEST_VERSION and CURRENT_VERSION columns of one or more of the following catalog tables, depending on the object:
- SYSIBM.SYSTABLESPACE
- SYSIBM.SYSTABLESPART
- SYSIBM.SYSINDEXES
- SYSIBM.SYSINDEXPART
The OLDEST_VERSION column contains the oldest used version number, and the CURRENT_VERSION column contains the current version number.
When you run REORG TABLESPACE, the utility sets all of the rows in the table or partition to the format of the current object version. The utility also updates the range of used version numbers for indexes that are defined with the COPY NO attribute. REORG TABLESPACE sets the OLDEST_VERSION column equal to the CURRENT_VERSION column in the appropriate catalog row. These updated values indicate that only one version is active. Db2 can then reuse all of the other version numbers.
Recycling of version numbers is required when all of the version numbers are being used. All version numbers are being used when one of the following situations is true:
- The value in the CURRENT_VERSION column is one less than the value in the OLDEST_VERSION column.
- The value in the CURRENT_VERSION column is 255 for table spaces or 15 for indexes, and the value in the OLDEST_VERSION column is 0 or 1.
When REORG TABLESPACE runs, if a system page is missing for a table that is in version 0 format, the utility adds a system page for version 0 of the table. When REORG TABLESPACE runs on a partitioned table space that is at version 0, the utility adds missing version 0 system pages to each partition.
You can also run LOAD REPLACE, REBUILD INDEX, or REORG INDEX to recycle version numbers for indexes that are defined with the COPY NO attribute. To recycle version numbers for indexes that are defined with the COPY YES attribute or for table spaces, run MODIFY RECOVERY.
The effect of REORG TABLESPACE on the control interval
When you run REORG TABLESPACE without the REUSE option and the target data set is managed by Db2, Db2 deletes this data set before REORG processing begins. Db2 then redefines a new data set with a control interval that matches the page size.
The effect of REORG TABLESPACE on row format
When you run REORG with the ROWFORMAT RRF option on a table space or partition that is in basic row format, REORG converts that table space or partition to reordered row format. If the ROWFORMAT BRF option is specified, existing basic row format table spaces are not converted to reordered row format. If there is a table in the table space with an EDITPROC or VALIDPROC, the table space or partition remains in basic row format after the REORG.
If you run REORG on a catalog or directory table space, the catalog or directory table space remains in basic row format.
You can run REORG TABLESPACE on table spaces that contain some partitions in basic row format and some partitions in reordered row format. In this case, the utility converts the partitions that are in basic row format to reordered row format.
REORG TABLESPACE converts a undefined table space to reordered row format if both of the following conditions are true:
- ROWFORMAT RRF is explicitly specified.
- The specified target is an entire undefined table space in basic row format.
In this case, Db2 updates the row format definition in the catalog and directory. No data sets are defined for the table space.
The effect of REORG on table spaces that are defined with NOT LOGGED attribute
The following table shows the effect of REORG on table spaces that are defined with the NOT LOGGED attribute.
LOAD REORG LOG keyword | Table space logging attribute | Table space type | What is logged | Table space status after utility completes |
---|---|---|---|---|
LOG YES | NOT LOGGED | Non-LOB | LOG YES changes to LOG NO | No pending status or ICOPY-pending1 |
LOG YES | NOT LOGGED | LOB | control information | No pending status |
LOG NO | NOT LOGGED | Non-LOB | nothing | No pending status or ICOPY-pending1 |
LOG NO | NOT LOGGED | LOB | nothing | No pending status |
Note:
|