Unloading data from image copy data sets
In addition to unloading data from table spaces and partitions, you can also unload data from one or more image copy data sets. The UNLOAD utility accepts full image copies, incremental image copies, and copies of pieces as valid input sources.
Before you begin
Ensure that the image copy data set that you want to unload from meets the following requirements:
- The source image copy data set must be created by one of the following
utilities:
- COPY
- COPYTOCOPY
- LOAD inline image copy
- MERGECOPY
- REORG TABLESPACE inline image copy
- DSN1COPY
- The image copy data set must be for a single table space.
- If you want to unload a ROWID column, the image copy must contain the page set header page.
- If you want to use UNLOAD to process image copies from different versions, the copy must be created with the SYSTEMPAGES YES option.
- If you want to unload compressed records, the image copy can be a full image copy or an incremental image copy. In either case, the copy must be created with the SYSTEMPAGES YES option. If the image copy data set is an incremental image copy or a copy of a partition or partitions, the same data set must contain the dictionary pages for decompression. If an image copy data set contains a compressed row and a dictionary is not available, DB2® issues an error message.
The
copy cannot be a VSAM FlashCopy® image copy. If the
object does not require system pages in front, you can create an image copy as a workaround. Use the
COPY utility or COPYTOCOPY utility to create a sequential format image copy from the FlashCopy image copy. Then, use the sequential format image
copy as input for UNLOAD.
About this task
Procedure
To unload data from image copy data sets:
- FROMCOPY
- Use the FROMCOPY option to unload rows from a single image copy
data set.
You can use the FROMCOPY option to specify a full or incremental copy of partitions of a segmented table space that consists of multiple data sets. However, if a mass delete operation occurred for a table in the table space before you created the copy, the utility might not unload the deleted rows. The utility unloads deleted rows only if the space map pages that indicate the mass delete are not included in the data set that corresponds to the specified copy. Therefore, where possible, use the FROMCOPYDDN option to concatenate the copy of table space partitions.
- FROMCOPYDDN
- Use the FROMCOPYDDN option to unload data from one or more image
copy data sets that are associated with the specified DD name.
You can use this option to concatenate the copy of table space partitions under a DD name to form a single input data set image. When you use the FROMCOPYDDN option, concatenate the data sets in the order of the data set number; the first data set must be concatenated first. If the data sets are concatenated in the wrong order or if different generations of image copies are concatenated, the results might be unpredictable. For example, if the most recent image copy data sets and older image copies are intermixed, the results might be unpredictable.
You can also use the FROMCOPYDDN option to concatenate a full image copy and incremental image copies for a table space, a partition, or a piece. However, duplicate rows are also unloaded. Instead, consider using the MERGECOPY utility to generate an updated full image copy as the input to UNLOAD.
When you specify the FROMCOPY or the FROMCOPYDDN option, you can specify only one output data set.
You can select specific rows and columns to unload just as you would for a table space. You can specify the selection criteria with either the PART keyword, the FROM TABLE clause, or both, to qualify tables and rows that are to be unloaded. However, do not include LOB columns in the field specification list. You can unload rows that contain LOB columns only when the LOB columns are excluded.
Specify the table space name in the TABLESPACE option. The specified table space must exist when you run UNLOAD. (The table space cannot have been dropped since the image copy was taken.) If an image copy contains rows from dropped tables, UNLOAD ignores these rows.
After you run UNLOAD, the image copy data is unloaded to the output data set. However, certain situations can affect the output as follows:
- Suppose that the image copy contains a table to which ALTER ADD COLUMN was applied after the image copy was taken. In this case, UNLOAD sets the system or user-specified default value for the added column when the data is unloaded from such an image copy.
- If an image copy was created by an inline copy operation, the image copy can contain duplicate pages. If duplicate pages exist, UNLOAD issues a warning message, and all the qualified rows in duplicate pages are unloaded into the output data set.
If
the image copy was taken with the SHRLEVEL CHANGE option specified,
rows might be updated or moved. As a result, data that is unloaded
from such a copy might contain duplicates of these rows.
The later two
situations can be prevented by using an image copy that was taken from a consistent FlashCopy.