| Comparing BCV5 with DSN1COPY |
|
|
The mechanism that BCV5 uses to move data is based on copying the VSAM clusters that DB2 uses to store tablespace and indexspace data. There is DB2 utility that works in a similar way: DSN1COPY. The speed of DSN1COPY and the built-in copy utility of BCV5 are comparable if you copy a single cluster. When you want to copy an entire database or even multiple databases with all associated tablespaces and indexspaces, the copy utility of BCV5 has the advantage of integrated parallel processing with a user-definable number of threads. To emulate this parallelism with DSN1COPY, you need to create an elaborate job chain and execute it under the control of a job scheduler. When the number of data sets becomes larger, you must also take other limitations like the maximum number of steps in a job into consideration when using DSN1COPY. The main problem with DSN1COPY, however, is the extremely low extend of automation that is built into this utility. Before the utility can be used, you must do a manual comparison of the source and target object structure in order to ensure that all attributes of all involved objects match. Some of these attributes need to be passed to the program in the form of invocation parameters to achieve usable results. The values that you need to look up are scattered over many catalog tables and need to be retrieved using multiple queries. In addition, you sometimes have to define some of the clusters in the target environment by yourself because DSN1COPY requires that all target clusters already be present. First of all, you need to determine which datasets to copy. Let’s say you want to copy a single tablespace with all its tables and indexes. If the tablespace is partitioned, it consists of more than one dataset. Each partition may have been subject to a fast switch operation, which changes the dataset name of the corresponding VSAM cluster. Also, the indexspaces can have a mangled name that is derived from the actual index name. Indexes, of course, may be partitioned as well. To illustrate the complexity of this seemingly simple task, here’s a query that can be used to give you the name of all datasets that belong to the tablespace DB000001.TS000001 and its indexes. Note that you have to insert the database name and tablespace name in both parts of the UNION when you want to use this query.
This query is already quite complex, but there are two things missing: It doesn’t take into consideration that a non-partitioned tablespace may have multiple pieces, and that the qualifier I0001 (or J0001) is sometimes I0002 (or J0002) if clone tables are involved. Knowing which datasets to copy is only half the battle. The following list of options illustrates the plethora of attributes that you need to look up for every single dataset that you want to copy using DSN1COPY:
Each of these options can be looked up in the catalog. For example, in order to determine the DBID, PSID, and list of OBIDs for a single tablespace, use something like this:
Execute this query in both the source and target environment. This will give you the information that you need to create the SYSXLAT member. Make sure you line up the OBIDs correctly, because they are returned unsorted by this query. For the indexspaces, you need to execute a similar query to find out DBID, PSOBID, and OBID of the index. As if all these options weren’t already enough, there are several additional steps that you need to take before and after you use DSN1COPY. You have to make sure that all attributes of all involved tablespaces, tables and indexes are identical in the source and target environment. Even small changes may render your copied tablespaces unusable. For example, if one of your target tables has a column that may contain NULL values, but that column in the corresponding source table may not contain NULL, you cannot use DSN1COPY to make a copy, even if everything else is identical. You have to drop and recreate the target table before you can use DSN1COPY. If you do the copy with DSN1COPY anyway, you will get error messages from the target DB2 when you try to access data from the target tablespace. Typically, you will get error 00C90101 or 00C90216 if the number of columns is different, or if the lengths or NULL attributes of the columns do not match. BCV5 can detect this situation. You have the option of using Unload/Load as a fallback mechanism for copying the data. This is completely transparent, because BCV5 will generate all the required JCL and input statements for you. The other option is to drop and recreate target objects that don’t match the structure of the source objects. Normally, when you drop and recreate an object, you must keep in mind that other objects may be lost as well due to the deletion of the first object. For example, dropping a table will always drop all related indexes, but you will also lose GRANTs and constraints that may have existed on the table, and that includes referential constraints to other tables. What seems like a quick drop and recreate can get out of hands very easily. BCV5 knows what has been dropped, and can recreate the target object as well as all dependent objects automatically for you. If you have changed your source tables at any point in time using ALTER statements, or if you have dropped tables that were located in a multi-table tablespace, you also need to determine if you need to regorganize the tablespace before copying it. If you fail to do so, the target DB2 may give you error messages when you access the copied tablespace. Typically, when the target DB2 encounters a row with an unexpected OBID, it will give you error 00C9021C when accessing the tablespace that has been copied with DSN1COPY. In contrast, BCV5 will detect if an alteration has taken place that prohibits the direct copy on VSAM cluster level. In some cases, BCV5 is able to make a direct copy where DSN1COPY cannot be used. For example, BCV5 is able to remove all records from a tablespace that belong to a dropped table during the copy, which means you don’t have to run REORG on your source tablespace before copying. You must also take care of allocation issues. The actual size of an object may differ from the information that is stored in the DB2 catalog. You need to do a LISTCAT on each of the clusters to find out the actual size. Then you must make sure that the target objects have allocation attributes that allow them to grow to the required size. BCV5 handles all the space calculation automatically and can redefine target clusters (without having to drop and recreate DB2 objects) if the corresponding tablespace or indexspace was created with too small allocation parameters. Finally, for all tables that contain an identity column, you need to look up the highest value that is currently used in the source subsystem. You must explicitly set a higher number as the number that is used next for the target table using an ALTER statement. Otherwise, when you insert a new row into a target table, DB2 might try to use an identity value that is already in use, resulting in an error. BCV5 generates and executes these ALTER statements automatically. In conclusion, while DSN1COPY can be automated to a certain degree using home-grown scripts and queries, its usage can be a pain if a large number of objects is involved, or if the set of objects to be copied changes. BCV5, on the other hand, offers unmatched flexibility in the selection, renaming and copying of DB2 objects and provides a streamlined, fully automated process that takes the pain out of fast copying. |
Für weitere Informationen über dieses Produkt hier klicken.
Für eine kostenlose Live-Demonstration dieses Produkts hier klicken.