Recovering the BSDS from a backup copy
In some situations, the bootstrap data set (BSDS) becomes damaged, and you need to recover the BSDS from a backup copy.
About this task
- Db2 is operating in single-BSDS mode, and the BSDS is damaged.
- Db2 is operating in dual-BSDS mode, and both BSDSs are damaged.
Procedure
To recover the BSDS from a backup copy:
- Locate the BSDS that is associated with the most recent
archive log data set. The data set name of the most recent archive log is displayed on the z/OS® console in the last occurrence of message DSNJ003I, which indicates that offloading has successfully completed. In preparation for the rest of this procedure, keep a log of all successful archives that are noted by that message.
- If archive logs are on disk, the BSDS is allocated on any available
disk. The BSDS name is like the corresponding archive log data set
name; change only the first letter of the last qualifier, from A to
B, as in the following example:
- Archive log name
- DSN.ARCHLOG1.A0000001
- BSDS copy name
- DSN.ARCHLOG1.B0000001
- If archive logs are on tape, the BSDS is the first data set of the first archive log volume. The BSDS is not repeated on later volumes.
- If archive logs are on disk, the BSDS is allocated on any available
disk. The BSDS name is like the corresponding archive log data set
name; change only the first letter of the last qualifier, from A to
B, as in the following example:
- If the most recent archive log data set has no copy of the BSDS (presumably because an error occurred during its offload), locate an earlier copy of the BSDS from an earlier offload.
- Rename or delete any damaged BSDS.
- To rename a damaged BSDS, use the access method services ALTER command with the NEWNAME option.
- To delete a damaged BSDS, use the access method services DELETE command.
For each damaged BSDS, use access method services to define a new BSDS as a replacement data set. Job DSNTIJIN contains access method services control statements to define a new BSDS. The BSDS is a VSAM key-sequenced data set (KSDS) that has three components: cluster, index, and data. You must rename all components of the data set. Avoid changing the high-level qualifier.
- Use the access method services REPRO command
to copy the BSDS from the archive log to one of the replacement BSDSs
that you defined in the prior step. Do not copy any data to the second
replacement BSDS; data is placed in the second replacement BSDS in
a later step in this procedure.
If the updated BSDS copy is in 6-byte RBA or LRSN format, and the damaged BSDS on the system to which you are restoring was in 10-byte RBA or LRSN format, run utility DSNJCNVT to convert the records in the restored BSDS to 10-byte format. See DSNJCNVT for information on how to do that. 
- Use the print log map utility (DSNJU004) to print the
contents of the replacement BSDS. You can then review the contents of the replacement BSDS before continuing your recovery work.
- Update the archive log data set inventory in the replacement
BSDS.
Examine the print log map output, and note that the replacement BSDS does not obtain a record of the archive log from which the BSDS was copied. If the replacement BSDS is a particularly old copy, it is missing all archive log data sets that were created later than the BSDS backup copy. Therefore, you need to update the BSDS inventory of the archive log data sets to reflect the current subsystem inventory.
Use the change log inventory utility (DSNJU003) NEWLOG statement to update the replacement BSDS, adding a record of the archive log from which the BSDS was copied. Ensure that the CATALOG option of the NEWLOG statement is properly set to CATALOG = YES if the archive log data set is cataloged. Also, use the NEWLOG statement to add any additional archive log data sets that were created later than the BSDS copy.
- Update DDF information in the replacement BSDS.
If the Db2 subsystem for your installation is part of a distributed network, the BSDS contains the DDF control record. You must review the contents of this record in the output of the print log map utility. If changes are required, use the change log inventory DDF statement to update the BSDS DDF record.
- Update the active log data set inventory in the replacement
BSDS.
In unusual circumstances, your installation might have added, deleted, or renamed active log data sets since the BSDS was copied. In this case, the replacement BSDS does not reflect the actual number or names of the active log data sets that your installation has currently in use.
If you must delete an active log data set from the replacement BSDS log inventory, use the change log inventory utility DELETE statement.
If you need to add an active log data set to the replacement BSDS log inventory, use the change log inventory utility NEWLOG statement. Ensure that the RBA range is specified correctly on the NEWLOG statement.
If you must rename an active log data set in the replacement BSDS log inventory, use the change log inventory utility DELETE statement, followed by the NEWLOG statement. Ensure that the RBA range is specified correctly on the NEWLOG statement.
- Update the active log RBA ranges in the replacement
BSDS. Later, when a restart is performed, Db2 compares the RBAs of the active log data sets that are listed in the BSDS with the RBAs that are found in the actual active log data sets. If the RBAs do not agree, Db2 does not restart. The problem is magnified when a particularly old copy of the BSDS is used. To resolve this problem, use the change log inventory utility to change the RBAs that are found in the BSDS to the RBAs in the actual active log data sets. Take the appropriate action, described below, to change RBAs in the BSDS:
- If you are not certain of the RBA range of a particular active log data set, use DSN1LOGP to print the contents of the active log data set. Obtain the logical starting and ending RBA values for the active log data set from the DSN1LOGP output. The STARTRBA value that you use in the change log inventory utility must be at the beginning of a control interval. Similarly, the ENDRBA value that you use must be at the end of a control interval. To get these values, round the starting RBA value from the DSN1LOGP output down so that it ends in X'000'. Round the ending RBA value up so that it ends in X'FFF'.
- When the RBAs of all active log data sets are known, compare the
actual RBA ranges with the RBA ranges that are found in the BSDS (listed
in the print log map utility output).
If the RBA ranges are equal for all active log data sets, you can proceed to step 4.g without any additional work.
If the RBA ranges are not equal, adjust the values in the BSDS to reflect the actual values. For each active log data set for which you need to adjust the RBA range, use the change log inventory utility DELETE statement to delete the active log data set from the inventory in the replacement BSDS. Then use the NEWLOG statement to redefine the active log data set to the BSDS.
- If only two active log data sets are specified
in the replacement BSDS, add a new active log data set for each copy
of the active log, and define each new active log data set of the
replacement BSDS log inventory.
If only two active log data sets are specified for each copy of the active log, Db2 might have difficulty during restart. The difficulty can arise when one of the active log data sets is full and has not been offloaded, whereas the second active log data set is close to filling. Adding a new active log data set for each copy of the active log can alleviate difficulties on restart in this situation.
To add a new active log data set for each copy of the active log, use the access method services DEFINE command. The control statements to accomplish this task can be found in job DSNTIJIN. After the active log data sets are physically defined and allocated, use the change log inventory utility NEWLOG statement to define the new active log data sets of the replacement BSDS. You do not need to specify the RBA ranges on the NEWLOG statement.
- Copy the updated BSDS copy to the second new BSDS data
set. The dual bootstrap data sets are now identical.
- Optional: Use the print log map utility (DSNJU004) to print the contents of the second replacement BSDS at this point.
- If you have lost your current active log data set, refer
to the following topics:
- Recovering from BSDS or log failures during restart
- Task 4: Truncate the log at the point of error, which provides information about how to construct a conditional restart control record (CRCR).
- Restart Db2, using
the newly constructed BSDS. Db2 determines the current RBA and what active logs need to be archived.