Resolving inconsistencies

In some problem situations, you need to determine what you must do in order to resolve any data inconsistencies that exist.

Procedure

To resolve inconsistencies:

  1. Determine the scope of any inconsistencies that are introduced by the situation.
    1. If the situation is either a cold start that is beyond the current end of the log or a conditional restart that skips backout or forward log recovery, use the DSN1LOGP utility to determine what units of work have not been backed out and which objects are involved.
      For a cold start that is beyond the end of the log, you can also use DSN1LOGP to help identify any restrictive object states that have been lost.
    2. If a conditional restart truncates the log in a non-data sharing environment, recover all data and indexes to the new current point in time, and rebuild the data and indexes as needed.
      You need to recover or rebuild (or both recover and rebuild) the data and indexes because data and index updates might exist without being reflected in the Db2 log. When this situation occurs, a variety of inconsistency errors might occur, including Db2 abends with reason code 00C200C1.
  2. Decide what approach to take to resolve inconsistencies by reading related topics about the approaches:
    • Recovery to a prior point of consistency
    • Restoration of a table space
    • Use of the REPAIR utility on the data
    The first two approaches are less complex than, and therefore preferred over, the third approach.
  3. If one or more of the following conditions are applicable, take image copies of all Db2 table spaces:
    • You did a cold start.
    • You did a conditional restart that altered or truncated the log.
    • The log is damaged.
    • Part of the log is no longer accessible.

    When a portion of the Db2 recovery log becomes inaccessible, all Db2 recovery processes have difficulty operating successfully, including restart, RECOVER, and deferred restart processing. Conditional restart allows circumvention of the problem during the restart process. To ensure that RECOVER does not attempt to access the inaccessible portions of the log, secure a copy (either full or incremental) that does not require such access. A failure occurs any time a Db2 process (such as the RECOVER utility) attempts to access an inaccessible portion of the log. You cannot be sure which Db2 processes must use that portion of the recovery log. Therefore, you need to assume that all data recovery activity requires that portion of the log.

    A cold start might cause down-level page set errors, which you can find out about in different ways:

    • Message DSNB232I is sometimes displayed during Db2 restart, once for each down-level page set that Db2 detects. After you restart Db2, check the console log for down-level page set messages.
      • If a small number of those messages exist, run DSN1COPY with the RESET option to correct the errors to the data before you take image copies of the affected data sets.
      • If a large number of those messages exist, the actual problem is not that page sets are down-level but that the conditional restart inadvertently caused a high volume of DSNB232I messages. In this case, temporarily turn off down-level detection by turning off the DLDFREQ ZPARM.
      In either case, continue with step 4.
    • If you run the COPY utility with the SHRLEVEL REFERENCE option to make image copies, the COPY utility sometimes issues message DSNB232I about down-level page sets that Db2 does not detect during restart. If any of those messages were issued when you are making image copies, correct the errors, and continue making image copies of the affected data sets.
    • If you use some other method to make image copies, you will find out about down-level page set errors during normal operation. In this case, you need to correct the errors by using the information in Recovering from a down-level page set problem.
  4. For any Db2 (catalog and directory) system table spaces that are inconsistent, recover them in the proper order. You might need to recover to a prior point in time, prior to the conditional restart.
  5. For any objects that you suspect might be inconsistent, resolve the database inconsistencies before proceeding.
    • First, resolve inconsistencies in Db2 system databases DSNDB01 and DSNDB06. Catalog and directory inconsistencies need to be resolved before inconsistencies in other databases because the subsystem databases describe all other databases, and access to other databases requires information from DSNDB01 and DSNDB06.
    • If you determine that the existing inconsistencies involve indexes only (not data), use the REBUILD INDEX utility to rebuild the affected indexes. Alternatively, you can use the RECOVER utility to recover the index if rebuilding the indexes is not possible.
    • For a table space that cannot be recovered (and is thus inconsistent), determine the importance of the data and whether it can be reloaded. If the data is not critical or can be reloaded, drop the table after you restart Db2, and reload the data rather than trying to resolve the inconsistencies.