DB2 Z/OS Cloning
The main purpose of this video-tutorial is to show you how to clone a DB2 subsystem to other subsystem running in the same Z/OS LPAR. Each step is explained with a video (screen cast). Video is opened when you click to the link.
It is supossed that you have two DB2 subsystems, in this case DB8G (source) and DBF (target), both up & running:
The procedure is automated in five main steps contained in library SYSADM.DBFCLONE. First two steps are related with the physical COPY from SOURCE datasets to TARGET DB2 datasets. While the remaining, are related with making target DB2 CATALOG consistent with the location of the DATASETS copied from source subsystem:
STEP 1: Delete Target DB2 DataSets
In order to do this, we stop TARGET (/-DBF STOP DB2) and delete all its datasets except the TARGET core (BSDS, LOGCOPY, SDSN libraries and installation jobs). The JCL that implements this is called RMVSAM.
STEP 2: Copy Source DB2 DataSets to Target DB2 renaming HLQ
Now, we stop target db2 (/-DB8G STOP DB2) and proceed to COPY SOURCE datasets to TARGET DB2, while renaming HLQ (High Level Qualifier). The JCL that implements this is called RENADB2.
At this point we can start both systems. In order to start TARGET DB2, it is recomended to issue a COLD START to prevent outstanding units of work from being backed out . The JCLs that implements this are PRNTBSDS (Print Source Boot Strap Data Set) and UPDTBSDS (Update Target Boot Strap DataSet).
Target DB2 subsystem is started in MAINTENACE MODE: /-DBF START DB2 ACCESS(MAINT)
STEP 4: Change Target Catalog to make it consistent with new DataSets location
So, now we got both systems up and runing, but TARGET DB2 storage groups point to source HLQ. So we have to update TARGET DB2 catalog to point to new HLQ. To do this we use REXX code to select all storage groups and generate DDL to:
1.- Alter all depenent tablespaces and indexspaces to a temporal storage group -> SYSADM.TEMP.CHTSSGT
2.- Drop all storage groups -> SYSADM.TEMP.DROPSTO
3.- Create all storage groups with new HLQ (VCAT) -> SYSADM.TEMP.CREASTO
4.- Alter all depenent tablespaces and indexspaces to their original storages groups -> SYSADM.TEMP.CHTSSGO
The JCLs that automates all this stuff are RENSTOGC (generates DDL to change STOGROUP VCAT) and ALTSTOG (executes it)
STEP 5: Restart Target DB2 Subsystem
Finally, we RESTART TARGET DB2 with normal parameters (DSNTIJUZ). After DB2 is restarted we should recreate DSNDB07 database with installation job DSNTIJTM.
Josep Vidal - System Programmer. For more questions you can reach me at: josepvidalcanet@gmail.com .