Improved data validation after running DSN1COPY
To prevent abends, data corruption, and storage overlays after the DSN1COPY utility runs, Db2 11 automatically validates the target data set. After a data set is populated by DSN1COPY, the first time that it is physically opened by an operation other than a utility, Db2 checks for certain data and catalog inconsistencies.
If DSN1COPY is not used correctly, subsequent attempts to access the data can result in abends, data corruption, and storage overlays. For example, the following scenarios might result in such errors:
- Incorrect DBID, PSID, or OBID values are specified when you run DSN1COPY with the OBIDXLAT option.
- DSN1COPY is used to copy data to a table space of a different type. For example, data is copied from a segmented table space to a partition-by-growth table space.
- DSN1COPY is used to copy data to a table space with a different version number or table schema.
In earlier versions of Db2, these data integrity errors might not be detected until a system failure occurs after the data is stored in the target table space. As a result, the data is unavailable.
Beginning in Db2 11, Db2 automatically detects these inconsistencies the first time that the data set is physically opened after being populated by DSN1COPY. Specifically, Db2 checks for any data and catalog inconsistencies for the following items and reports them with a -904 SQL code:
- DBID, PSID, and OBID
- SEGSIZE and PAGESIZE
- Table space type
- Table schema (Db2 checks this item if the table space contains only one table, and an OBDREC is stored in the system page.)
Several exception situations exist. Db2 does not check for data and catalog inconsistencies during the following situations:
- The data set is physically opened by a utility, including the REPAIR utility.
- Db2 is restarting.
- The header page is not formatted yet.
- The REPAIR utility is operating on the header page. (The REPAIR utility closes the page set when it is finished. Therefore, validation can be done the next time that the data set is physically opened.)
- The LOGAPPLY phase of the RECOVER utility is processing.
By not checking for inconsistencies during these situations, Db2 limits any performance impact.
If any inconsistencies are reported, you can then correct them by using the REPAIR utility with the new CATALOG option. You can also use the REPAIR utility to proactively check for any inconsistencies after you run DSN1COPY instead of waiting for the data set to be physically opened. In this case, use the REPAIR utility with the CATALOG TEST option.