Recycling table space version numbers

To prevent DB2® from running out of table space version numbers, and to prevent subsequent ALTER statements from failing, you must recycle unused table space version numbers regularly.

About this task

DB2 can store up to 256 table space versions, numbered sequentially from 0 to 255. The next consecutive version number after 255 is 1. Version number 0 is never reused; it is reserved for the original version of the table space. The versions are associated with schema changes that have not been applied, but are considered to be in use. The range of used versions is stored in the catalog. If necessary, in-use versions can be recovered from image copies of the table space.

Procedure

To recycle table space version numbers:

  1. Determine the range of version numbers that are currently in use for a table space by querying the OLDEST_VERSION and CURRENT_VERSION columns of the SYSIBM.SYSTABLESPACE catalog table.

    Version numbers are considered to be unused if the schema changes that are associated with them have been applied, and there are no image copies that contain data at those versions.

    If all reusable version numbers (1 to 255) are currently in use, you must reorganize the table space by running the REORG TABLESPACE utility before you can recycle the version numbers.

  2. Recycle the unused table space version numbers by running the MODIFY RECOVERY utility.