Handling Db2 versioning information


When you move objects that contain system pages from one Db2 subsystem to another Db2 subsystem, the version information on the target Db2 subsystem must match the version information on the source Db2 subsystem. If the version information does not match, you cannot access the data on the target Db2 subsystem.

If your version information does not match, use the following steps to move objects to another Db2 subsystem and to ensure that the version information matches.

Related topic

To move objects to another Db2 subsystem

  1. Ensure that the object definitions on the source and target Db2 subsystems are the same.For table space, each table must have the same number of columns, and each column must be the same data type.

    Tip

    Use the same ALTER TABLE statement on both the source and target objects.

  2. If you are copying indexes that have not been altered in Db2, check the SYSIBM.SYSINDEXES catalog table on both subsystems to ensure that the value in both the CURRENT_VERSION column and the OLDEST_VERSION column is 0.

    Tip

    Ensure that you do an insert after the last ALTER to a table to force the creation of a system page, or use BMC AMI Copy with the GENSYSPAGES option to make the copy. If you are copying indexes and an index was altered, you might need to REBUILD the index to update the index directory page with the latest version before making the copy.

  3.  Run BMC AMI Recover on the target subsystem with the OBIDXLAT option. On the control statement, specify the proper mapping of table database object identifiers (OBIDs) for the table space or index from the source to the target subsystem.

    Important

    If you need to rebuild indexes on your target system, do not do so until after you have completed step 4.

  4.  Run DB2 REPAIR VERSIONS on the object on the target subsystem or specify the BMC AMI Recover UPDATE VERSIONS option in step 3.This action updates the version numbers in the target system’s catalog using the version numbers in the system pages or index directory pages that have been laid down from the source system.

    For table spaces, the utility updates the following columns:

    • OLDEST_VERSION and CURRENT_VERSION in SYSTABLEPART
    • VERSION in SYSTABLES
    • OLDEST_VERSION and CURRENT_VERSION in SYSTABLESPACE

    For indexes, the utility updates OLDEST_VERSION and CURRENT_VERSION in SYSINDEXES. Db2 uses the following formulas to update these columns in both SYSTABLEPART and SYSINDEXES:

    CURRENT_VERSION = MAX(target.CURRENT_VERSION,source.CURRENT_VERSION)
    OLDEST_VERSION = MIN(target.OLDEST_VERSION,source.OLDEST_VERSION)
  5. If you need to rebuild indexes on your target system, you can do so now.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*