Data sets that DSN1COPY uses
The DSN1COPY utility uses a number of data sets during its operation.
Required data sets
DSN1COPY uses the following data sets:
- Input data set
- Input to DSN1COPY. The DD name is SYSUT1.
- Output data set
- Output from DSN1COPY. The DD name is SYSUT2. Optional.
- Message data set
- Data set for output messages. The DD name is SYSPRINT.
- OBIDXLAT data set
- Data set that defines the OBID translation values. The DD name is SYSXLAT.
DSN1COPY uses the following DD statements:
- SYSPRINT
- Defines the data set that contains output messages from the DSN1COPY program and all hexadecimal dump output.
- SYSUT1
Defines the input data set. This data set can be a sequential data set that is created by the DSN1COPY or COPY utilities, or a VSAM data set, including a FlashCopy® image copy data set.
Specify the data set's disposition as DISP=OLD to ensure that it is not in use by Db2. Specify the data set's disposition as DISP=SHR only when the Db2 STOP DATABASE command does not work.
The requested operation takes place only for the specified data set. If the input data set is a partitioned table space or index, ensure that you specify the NUMPARTS parameter and the correct data set. For example, to print a page range in the second partition of a four-partition table space, specify NUMPARTS(4) and the data set name of the second data set. This second data set is in the group of VSAM data sets, and the VSAM data set name is DSNCAT.DSNDBD.TESTDB.TS01.I0001.A002. The last qualifier (A002) represents the partition number 2.
To copy the data sets for a segmented (non-UTS) table space that consists of multiple data sets, you need to run multiple DSN1COPY jobs. Run one job for each data set in the table space.
If running the online REORG utility with the FASTSWITCH option, verify the data set name before running the DSN1COPY utility. The fifth-level qualifier in the data set name alternates between I0001 and J0001 when using FASTSWITCH. If the table space has cloning or ever had cloning, the fifth-level qualifier can be I0002 or J0002. You cannot specify FASTSWITCH YES if the table space has cloning; however, a FASTSWITCH YES REORG might have been done before the clone was created so you might still have a mixture of 'I' and 'J' data sets. Specify the correct fifth-level qualifier in the data set name to successfully execute the DSN1COPY utility. To determine the correct fifth-level qualifier, query the IPREFIX column of SYSIBM.SYSTABLEPART for each data partition or the IPREFIX column of SYSIBM.SYSINDEXPART for each index partition. If the object is not partitioned, use zero as the value for the PARTITION column in your query.
To determine the instance number to use for a fifth-level qualifier, query the INSTANCE column of SYSIBM.SYSTABLESPACE. The returned value is the instance number that represents the current base objects. The clone objects would be represented by the other instance number. If a query of SYSTABLESPACE.INSTANCE returns a value of 2, then the base objects are represented by instance number 2 data sets and the clone objects by instance number 1 data sets. This process can be used to determine the instance number even if there is no active cloning.
- SYSUT2
- Defines the output data set. This data set can be a sequential data
set, a VSAM data set, or a DUMMY data set.
What you specify for SYSUT2 is restricted if both of the following conditions are true:
- SYSUT1 is an image copy of an entire partitioned table space or an image copy of all data sets of a multi-piece object
- The data is to be copied to a Db2 table space or Db2 index space
In this case, SYSUT2 must be the name of first data set (of the first partition or of the first piece) for the table space or index space. For example, the last part of the name must identify the data set number A001.
DSN1COPY identifies the appropriate output data set by the page number and allocates other data sets for additional partitions. The names of these data sets also follow the Db2 data set naming conventions. For example, these data set names end with A002, A003, and so on.
All target data sets must be defined. To define the data sets for a multi-piece object, create first the table space or index with DEFINE YES and specify appropriate primary and secondary quantities. If -1 is specified for primary and/or secondary quantity DSN1COPY may run out of extents because Db2 defines the first data set with small primary and/or secondary extents in this case. Db2 then defines the first data set. The subsequent data sets can be defined by using Access Method Services. See Copying tables from one subsystem to another for more information.
DSN1COPY assumes that the output data sets are empty (that is, the program adds the blocks) except when you specify INCRCOPY. Before you run DSN1COPY, define your VSAM output data sets as REUSE. If you have not defined the data sets, you must redefine all VSAM output data sets you are restoring by using Access Method Services. Ensure that these data sets are empty before you run DSN1COPY.
You might want to specify a DUMMY SYSUT2 DD statement if you are dumping or checking pages.
To enable Db2 to obtain necessary information from the integrated catalog facility catalog when using VSAM data sets, do not code the unit-serial parameter and volume-serial parameter.
If running the online REORG utility with the FASTSWITCH option, verify the data set name before running the DSN1COPY utility. The fifth-level qualifier in the data set name alternates between I0001 and J0001 when using FASTSWITCH. Specify the correct fifth-level qualifier in the data set name to successfully execute the DSN1COPY utility.
- SYSXLAT
- Defines for translation the DBIDs, OBIDs, data page set identifiers (PSIDs), or index page set
identifiers (ISOBIDs).
If you have dropped a table without a subsequent REORG of the table space, you must reorganize the source table space before running DSN1COPY with the OBIDXLAT option. This action removes any previously dropped records from the table space.
A non-numeric character must separate each record in the SYSXLAT file, and each record must contain a pair of decimal integers. The first integer of each record pertains to the source, and the second integer pertains to the target. The first record in the SYSXLAT file contains the source DBIDs and the target DBIDs; the values can range from -32767 to 65535. The second record contains the source and target PSIDs or ISOBIDs; the values can range from 0 to 32767. All subsequent records in the SYSXLAT data set are for table OBIDs. For an index, the SYSXLAT data set must contain the index fan set OBID, in addition to the DBID and ISOBID. Sample data in a SYSXLAT file follows (with an indication of how each record translates shown in parentheses):
260,280 (source DBID 260 translates to target DBID 280) 2,10 (source PSID 2 translates to target PSID 10) 3,55 (source table OBID 3 translates to target table OBID 55) 6,56 (source table OBID 6 translates to target table OBID 56) 7,57 (source table OBID 7 translates to target table OBID 57
To obtain the names, DBIDs, PSIDs, ISOBIDs, and OBIDs, run the DSNTEP2 sample application on both the source and target systems. The following SQL statements yield the preceding information.
The example for indexes yields output that is similar to the preceding example, but with an additional column of data.
For table spaces use the following statements:
For index spaces use the following statement:SELECT DBID, PSID FROM SYSIBM.SYSTABLESPACE WHERE NAME='tablespace_name' AND DBNAME='database_name'; SELECT NAME, OBID FROM SYSIBM.SYSTABLES WHERE TSNAME='tablespace_name' AND CREATOR='creator_name';
SELECT DBID, ISOBID, OBID FROM SYSIBM.SYSINDEXES WHERE NAME='index_name' AND CREATOR='creator_name';
Several examples of using DSN1COPY follow:
- Create a backup copy of a Db2 data
set:
- SYSUT1: DB2-VSAM
- SYSUT2: Sequential data set
- Restore a backup copy of a Db2 data
set:
- SYSUT1: DSN1COPY sequential data set
- SYSUT2: DB2-VSAM
- Move a Db2 data
set to another Db2 data
set:
- SYSUT1: DB2-VSAM
- SYSUT2: DB2-VSAM
- Parameters: OBIDXLAT, RESET
- Perform validity checking on a Db2 data
set:
- SYSUT1: DB2-VSAM
- SYSUT2: DUMMY
- Parameter: CHECK
- Perform validity checking on and print a Db2 data
set:
- SYSUT1: DB2-VSAM
- SYSUT2: DUMMY
- Parameters: CHECK, PRINT
- Restore a table space from a nonpartitioned image copy data set
or page set:
- SYSUT1: Db2 full image copy
- SYSUT2: DB2-VSAM
- Parameter: FULLCOPY
- Restore a table space from a partitioned image copy data or page
set:
- SYSUT1: Db2 full image copy
- SYSUT2: DB2-VSAM
- Parameters: FULLCOPY, NUMPARTS(nn)
- Perform RBA RESET on a Db2 data
set:
- SYSUT1: DB2-VSAM or DSN1COPY sequential data set
- SYSUT2: DB2-VSAM
- Parameter: RESET
Defining the input data set
The SYSUT1 data set can be any of the following types:
- A Db2 table space data set
- A Db2 index space data set
- A sequential full image copy
- An incremental image copy
- An inline image copy
- A sequential data set that was previously created by DSN1COPY
- A FlashCopy image copy data set
Define SYSUT1 with DISP=OLD to ensure that DSN1COPY uses it exclusively. If SYSUT1 is a table space or index space, use the following procedure before using DSN1COPY:
- Issue the following command to determine if the object is stopped:
-DISPLAY DATABASE (database_name) SPACENAM(space_name) RESTRICT
- If Db2 has not stopped the
object, issue the following command to stop the object:
-STOP DATABASE (database_name) SPACENAME(space_name)
Db2 allows input of only one DSN1COPY data set. Db2 does not permit the input of concatenated data sets. For a table space that consists of multiple data sets, ensure that you specify the correct data set. For example, if you specify the CHECK option to validate pages of a partitioned table space's second partition, code the second data set of the table space for SYSUT1.
Defining the output data set
The SYSUT2 data set can be any of the following types:
- A sequential data set
- A Db2 table space data set
- A Db2 index space data set
- A DUMMY data set
Specify a DUMMY SYSUT2 DD statement if you are using DSN1COPY to check or dump a page. The table spaces and index spaces must either be empty or defined with VSAM REUSE. STOGROUP-defined table spaces and index spaces have the REUSE attribute, except when you are applying the INCRCOPY option.
When you use the RESET option to reset page log RBAs, you need to ensure that the output data set for the RESET operation has the same name as the original Db2 data set. Use either of the following techniques to do that:
- Method 1:
- Make a backup copy of your original Db2 data set by using DSN1COPY to copy the original data set to a sequential data set.
- If you defined your original Db2 data set without the REUSE parameter, delete and redefine the original data set.
- Run DSN1COPY with the RESET option. Specify the output data set from step 1 as the input data set for the RESET operation.
Use your original Db2 data set or the redefined version of the original data set as the output data set for the RESET operation.
- Method 2:
- Run DSN1COPY with the RESET option. Use your original Db2 data set as the input data set. Define a new VSAM data set as the output data set. The output data set must have the same data set characteristics as the input data set.
- Delete the input data set from step 1.
- Rename the output data set from step 1 to the same name as the input data set.
Adding additional volumes for SYSUT2
When you create a table space or index space by using STOGROUP, the ICF catalog entry has only one volume in the volume list. If the SYSUT2 data set that DSN1COPY restores requires more than one volume, use the IDCAMS command, ALTER ADDVOLUMES, to add additional volume IDs to the integrated catalog entry. The extension to new volumes uses the primary size on each new volume. This is the normal VSAM extension process. If you want the data set to use the secondary size on the candidate volumes, follow these steps:
- Run DSN1COPY.
- Run REORG, or make a full image copy and recover the table space.
Performing these steps resets the data set and causes normal extensions through Db2.