Recovering Db2 by creating a gap in the active log

If your site experiences an excessive loss of active log data, you can recover by creating a gap in the active log.

Procedure

To recover by creating a gap in the active log:

  1. Use the print log map utility (DSNJU004) on the copy of the BSDS with which Db2 is to be restarted.
  2. Use the print log map output to obtain the data set names of all active log data sets. Use the access method services LISTCAT command to determine which active log data sets are no longer available or usable.
  3. Use the access method services DELETE command to delete all active log data sets that are no longer usable.
  4. Use the access method services DEFINE command to define new active log data sets. Run the DSNJLOGF utility to initialize the new active log data sets. Define one active log data set for each one that is found to be no longer available or usable in step 2. Use the active log data set name that is found in the BSDS as the data set name for the access method services DEFINE command.
  5. Refer to the print log map utility (DSNJU004) output, and note whether an archive log data set exists that contains the RBA range of the redefined active log data set.
    To do this, note the starting and ending RBA values for the active log data set that was recently redefined, and look for an archive log data set with the same starting and ending RBA values.

    If no such archive log data sets exist:

    1. Use the change log inventory utility (DSNJU003) DELETE statement to delete the recently redefined active log data sets from the BSDS active log data set inventory.
    2. Use the change log inventory utility (DSNJU003) NEWLOG statement to add the active log data set to the BSDS active log data set inventory. Do not specify RBA ranges on the NEWLOG statement.

    If the corresponding archive log data sets exist, two courses of action are available:

    • If you want to minimize the number of potential read operations on the archive log data sets, use the access method services REPRO command to copy the data from each archive log data set into the corresponding active log data set. Ensure that you copy the proper RBA range into the active log data set.

      Ensure that the active log data set is large enough to hold all the data from the archive log data set. When Db2 does an archive operation, it copies the log data from the active log data set to the archive log data set, and then pads the archive log data set with binary zeros to fill a block. In order for the access method services REPRO command to be able to copy all of the data from the archive log data set to a recently defined active log data set, the new active log data set might need to be larger than the original one.

      For example, if the block size of the archive log data set is 28 KB, and the active log data set contains 80 KB of data, Db2 copies the 80 KB and pads the archive log data set with 4 KB of nulls to fill the last block. Thus, the archive log data set now contains 84 KB of data instead of 80 KB. In order for the access method services REPRO command to complete successfully, the active log data set must be able to hold 84 KB, rather than just 80 KB of data.

    • If you are not concerned about read operations against the archive log data sets, complete the two steps that appear in the steps 5.a and 5.b (as though the archive data sets did not exist).
  6. Choose the appropriate point for Db2 to start logging.
    To do this, determine the highest possible log RBA of the prior log. From previous console logs that were written when Db2 was operational, locate the last DSNJ001I message. When Db2 switches to a new active log data set, this message is written to the console, identifying the data set name and the highest potential log RBA that can be written for that data set. Assume that this is the value X'8BFFF'. Add one to this value (X'8C000'), and create a conditional restart control record that specifies the following change log inventory control statement:
    CRESTART CREATE,STARTRBA=8C000,ENDRBA=8C000
    When Db2 starts, all phases of restart are bypassed, and logging begins at log RBA X'8C000'. If you choose this method, you do not need to use the RESET option of the DSN1COPY utility, and you can save a lot of time.
  7. To restart Db2 without using any log data, create a conditional restart control record for the change log inventory utility (DSNJU003).
  8. Start Db2. Use the START DB2 ACCESS(MAINT) command until data is consistent or page sets are stopped.
  9. After restart, resolve all inconsistent data as described in Resolving inconsistencies resulting from a conditional restart.

Results

This procedure causes all phases of restart to be bypassed and logging to begin at the point in the log RBA that you identified in step 6 (X'8C000' in the example given in this procedure). This procedure creates a gap in the log between the highest RBA kept in the BSDS and, in this example, X'8C000', and that portion of the log is inaccessible.

What to do next

Because no Db2 process can tolerate a gap, including RECOVER, you need to take image copies of all data after a cold start, even data that you know is consistent.