Recovering from I/O errors while reading the active log
You can recover from situations in which an I/O error occurs when Db2 is reading the active log.
Symptoms
The following message is issued:
DSNJ106I - LOG READ ERROR DSNAME=..., LOGRBA=...,
ERROR STATUS=ccccffss
Environment
- If the error occurs during offload, offload tries to identify
the RBA range from a second copy of the active log.
- If no second copy of the active log exists, the data set is stopped.
- If the second copy of the active log also has an error, only the original data set that triggered the offload is stopped. Then the archive log data set is terminated, leaving a discontinuity in the archived log RBA range.
- The following message is issued:
DSNJ124I - OFFLOAD OF ACTIVE LOG SUSPENDED FROM RBA xxxxxx TO RBA xxxxxx DUE TO I/O ERROR - If the second copy of the active log is satisfactory, the first copy is not stopped.
- If the error occurs during recovery, Db2 provides data from specific log RBAs that are requested from another copy or archive. If this is unsuccessful, recovery fails and the transaction cannot complete, but no log data sets are stopped. However, the table space that is being recovered is not accessible.
Resolving the problem
System programmer response:
- If the problem occurred during offload, determine which databases are affected by the active log problem, and take image copies of those. Then proceed with a new log data set.
- You can use the IDCAMS REPRO command to archive as much of the stopped active log data set as possible. Then run the change log inventory utility to notify the BSDS of the new archive log and its log RBA range. Repairing the active log does not solve the problem because offload does not go back to unload it.
- If the active log data set has been stopped, it is not used for logging. The data set is not deallocated; it is still used for reading.
- If the data set is not stopped, an active log data set should nevertheless be replaced if persistent errors occur. The operator is not told explicitly whether the data set has been stopped. To determine the status of the active log data set, run the print log map utility (DSNJU004).
- If you need to replace the data set:
- Ensure that the data is saved.
If you have dual active logs, the data is saved on the other active log, which becomes your new data set. Skip to step 4.
If you are not using dual active logs, take the following steps to determine whether the data set with the error has been offloaded:- Use the print log map utility (DSNJU004) to list information about the archive log data sets from the BSDS.
- Search the list for a data set whose RBA range includes the range of the data set with the error.
- If the data set with the error has been offloaded (that is, if the value for high RBA offloaded in the print log map utility output is greater than the RBA range of the data set with the error), manually add a new archive log to the BSDS by using the change log inventory utility (DSNJU003). Use IDCAMS to define a new log that has the same LRECL and BLKSIZE values as defined in DSNZPxxx. You can use the access method services REPRO command to copy a data set with the error to the new archive log. If the archive log is not cataloged, Db2 can locate it from the UNIT and VOLSER values in the BSDS.
- If an active log data set has been stopped, an RBA range has not been offloaded; copy from the data set with the error to a new data set. If additional I/O errors prevent you from copying the entire data set, a gap occurs in the log and restart might fail, although the data still exists and is not overlaid. If this occurs, see Recovering from BSDS or log failures during restart.
- Stop Db2, and
use the change log inventory utility to update information in the
BSDS about the data set with the error.
- Use DELETE to remove information about the bad data set.
- Use NEWLOG to name the new data set as the
new active log data set and to give it the RBA range that was successfully
copied.
The DELETE and NEWLOG operations can be performed by the same job step; put DELETE before NEWLOG in the SYSIN input data set. This step clears the stopped status, and Db2 eventually archives it.
- Delete the data set that is in error by using access method services.
- Redefine the data set so that you can write to it. Use the access method services DEFINE command to define the active log data sets. If you use dual logs and have a good copy of the log, use the REPRO command to copy the contents to the new data set that you just created. If you do not use dual logs, initialize the new data set by using the DSNJLOGF utility.
- Ensure that the data is saved.