This section describes the reengineering rules applied by the Rehosting Workbench when migrating data from a DB2 database to an Oracle database.The list of DB2 objects that are included in the migration towards Oracle are described in Creating the Generated Oracle Objects.Migrated DB2 objects keep their names when migrated to Oracle except for the application of the Rehosting Workbench renaming rules (see Preparing and Implementing Renaming Rules).
Table 4‑1 DB2 to Oracle Data Types
Table 4‑2 DB2 to Oracle Column Properties <value> depends on DB2/z/OS data type. Renaming rules should be placed in a file named rename-objects-<schema name>.txt. This file should be placed in the directory indicated by the $PARAM/rdbms parameter.
•
• Oracle Tuxedo Application Rehosting Workbench permits the download of CLOB and BLOB data types. The DB2 unloading utility downloads each row of CLOB or BLOB columns into a separate file (PDS or HFS dataset type). This utility (DSNUTILB) downloads data of all columns and NULL technical flags into a unique MVS member file, excepted for CLOB or BLOB columns wich are replaced by the file name of the CLOB or BLOB separate file.Based on those two constraints, you should set correct parameters in db-param.cfg configuration file (see Implementing the Configuration Files).Oracle Tuxedo Application Rehosting Workbench provides the transcoding for single byte data. However, if your DB2 data contains MBCS characters, you should choose DSNUPROC unloading utility and set csv data format. The MBCS transcoding is done by the transfer tools.Based on this constraint, you have to set correct parameters in db-param.cfg configuration file (see Implementing the Configuration Files).Listing 4‑1 DDL Example Before MigrationListing 4‑2 Oracle Table Example After MigrationListing 4‑3 Oracle Index Example After MigrationListing 4‑4 Oracle Constraint Example After MigrationFor a DB2-To-Oracle migration, a parameter must be set in the system.desc System Description File that is used by all of the Rehosting Workbench tools:By default, if the SQL commands of the DB2 DDL are prefixed by a qualifier or an authorization ID, the prefix is used by the Rehosting Workbench as the name of the schema—for example, CREATE TABLE <qualifier or authorization ID>.table name.The schema name can also be determined by the Rehosting Workbench using the global-options clause of the system.desc file.The schema name can also be determined for each DDL directory by the Rehosting Workbench using the directory options clause of the system.desc file. See section options-clause documented in Cataloger chapter.options SQL-Schema = "<schema name>".
•
• export TMPPROJECT=/$home/tmpListing 4‑5 Example db-param.cfg File
• target_rdbms_name: oracle
• The following rdbms parameters indicate the date, timestamp, and time formats used by z/OS DB2 and stored in DSNZPARM:
• rdbms:date_format: YYYY/MM/DD
• rdbms:timestamp_format:YYYY/MM/DD HH24 MI SS FF6
• rdbms:time_format:HH24 MI SSThese parameters impact the reloading operations, COBOL date, and time manipulations. They are optional and only necessary if the DB2 database contains the DATE, TIME or TIMESTAMP fields.
WARNING: Correct setting of these parameters is essential.The following rdbms parameters are optional and only necessary if the DB2 schema contains CLOB or BLOB data types.
• If the length of target MVS dataset name is equal to “MIGR.SCH1.TAB1.COLUMN1” (22 characters), the maximum length of the string created by the JCL would be 32: 22 + 2 (parenthesis characters) + 8 (member name).
• If the length of target MVS directory name is equal to “/LOB/SCHEMA2/TABLE2/SECOND2” (27 characters), the maximum length of the string created by the JCL would be 36: 27 + 1 (slash character) + 8 (file name).
Note:
•
• If the database contains MBCS characters, you should choose "dsnuproc" as the unloading utility and "csv" as the unloading format.To generate the components used to migrate data from DB2 databases to Oracle databases, the Rehosting Workbench uses the rdbms.sh command. This section describes the command.rdbms.sh generates the Rehosting Workbench components used to migrate z/OS DB2 databases to UNIX Oracle databases.The following components are generated in $TMPPROJECT: DDL Oracle, the SQL*LOADER CTL files, the XML file used by the COBOL converter,and configuration files (mapper.re and Datamap.re). If an error or warning is encountered, the process will not abort.See Executing the Transcoding and Reloading Scripts for information about the SQL scripts created during the generation operation.This option has the same result as the -C option except the process will abort if an error or warning is generated.The unloading and loading components are generated in $TMPPROJECT using the information provided by the configuration files. You should run the rdbms.sh command with -C or -c command before this option.Removes the schema name from the generated objects (create table, table name, CTL file for SQL*LOADER, KSH). When this option is used, the name of the schema can also be removed from the COBOL components by using the option: sql-remove-schema-qualifier located in the config-cobol file (COBOL conversion configuration file) used when converting the COBOL components.Places the components in the installation directory. This operation uses the information located in the rdbms-move-assignation.pgm file.Enables the generation of the COBOL convertor configuration file. This file takes all of the unitary XML files of the project. All these files are created in $PARAM/dynamic-config.Example: rdbms-conv.txt rdbms-conv-PJ01DB2.xmlThe version.mk configuration file in $PARAM is used to set the variables and parameters required by the make utility.In version.mk specify where each type of component is installed and their extensions, as well as the versions of the different tools to be used. This file also describes how the log files are organized.The following general variables should be set at the beginning of migration process in the version.mk file:
• In addition, the RDBMS_SCHEMAS variable is specific to DB2 migration, it indicates the different schemas to process.The make RdbmsConvert command can be used to launch the Rehosting Workbench DB2-To-Oracle Converter. It enables the generation of the components required to migrate a DB2 database to Oracle.The make file launches the rdbms.sh tool with the -C, -g, -r, -m and -i options, for all schemas contained in the RDBMS_SCHEMAS variable.The unloading and loading components generated with the -i $HOME/trf option are placed in the following locations:
Table 4‑3 Location of Components The generation log files produced when using the -c or -C options. rdbms-converter-<schema name> can be used to resolve problems.When present, this file will be automatically executed at the end of the generation process. It will be called using the <schema name> as an argument.This section describes the tasks of unloading, transfer and reloading using the components generated using the Rehosting Workbench (see Generating the Components).The components used for the unloading (generated in $HOME/trf/unload/rdbms) should be installed on the source z/OS platform. The generated JCL may need adapting to specific site constraints including JOB cards, library access paths and access paths to input and output files (Data Set Name – DSN).The components used for the reloading (generated in $HOME/trf/reload/rdbms) should be installed on the target platform (runtime).Table 4‑4 lists environment variables that should be set on the target platform.
Table 4‑4 Variables and Their Platform The location of the generic reload and control scripts ($HOME/trf/reload/bin) Directory containing the <table name>.ctl files used by the SQL*LOADER ($HOME/trf/reload/rdbms/<schema name>/ctl). Set according to the instructions in Oracle Tuxedo Application Rehosting Workbench Reference Guide and other Oracle documentation. Set according to the instructions in Oracle Tuxedo Application Rehosting Workbench Reference Guide and other Oracle documentation.The following variable should be set according to the information in the Oracle Tuxedo Application Rehosting Workbench Installation Guide:The reloading script loadrdbms-<table name>.ksh uses the SQL*LDR Oracle utility. Because this utility can access to ORACLE servers only, this script should be used in ORACLE servers and not with client connection. This variable should not contain an @<oracle_sid> string, especially for this reloading step.The package functions called by COBOL programs (converted by Oracle Tuxedo Application Rehosting Workbench COBOL Converter) should be installed on the target platform (runtime).The packages are located in REFINEDIR/convert-data/fixed-components/MWDB2ORA.plb and REFINEDIR/convert-data/fixed-components/MWDB2ORA_CONST.plb. You should adapt the MWDB2ORA_CONST.plb package and install these packages under SQLPLUS as documented in the Oracle Tuxedo Application Rehosting Workbench DB2 to Oracle Converter.These files are written in another dataset or directory if the parameter rdbms:jcl_unload_lob_file_system is respectively set to pds or hfs.
• Example:ODCSF0X1.jclunloadThe files transferred to the target UNIX platform should be stored in the $DATA_SOURCE directory.The CLOB and BLOB data files should be transferred in binary mode and stored in the $DATA_SOURCE/<schema_name>.<column_name> directory.
Note: On MVS, the Rehosting Workbench attributes a six-character name to <column_name> to the dataset or directory, added with a digit number (1 for the first CLOB or BLOB column of the table, 2 for the second, ...). On UNIX/Linux platform, the loadrdbms.sh script uses the real column_name.The scripts creating Oracle objects (tables, index, constraints, …) are created in the $HOME/trf/SQL/rdbms/<schema name> directory. They should be executed in the target Oracle instance.The <schema name>.lst file contains the names of all of the tables in hierarchical sequence (parent table then child tables).Table 4‑5 lists the DB2 objects managed by the Rehosting Workbench and the name of the script used to create them:
Table 4‑5 DB2 Objects This file contains all the CREATE INDEXes associated with the table <target_table_name>. This file will not be generated if there are no indexes defined on the table <target_table_name> The programs should be compiled using the target COBOL compiler and the options documented in the Oracle Tuxedo Application Rehosting Workbench Reference Guide.The programs produce RECORD SEQUENTIAL files on output that will then be read by the SQL*LOADER utility.Listing 4‑6 FILE CONTROL Example – Extracted from Program: MOD_ODCSF0.cblloadrdbms-<table name>.ksh<table name>.ctl.For the example provided in Example of a Migration of DB2 Objects, the generated script is:
• If the rdbms-converter-<schema name>.log file contains any errors (see Common Problems and Solutions).Error messages and associated explanations are listed in the appendix of the Oracle Tuxedo Application Rehosting Workbench Reference Guide.When executing $REFINEDIR/$VERS/rdbms.sh -Cgrmi $HOME/trf PJ01DB2 STFILEORA the following message appears:When executing $REFINEDIR/$VERS/rdbms.sh -Cgrmi $HOME/trf SCHEMA the following message appears:When executing $REFINEDIR/$VERS/rdbms.sh -Cgrmi $HOME/trf PJ01DB2 the following message appears:When executing $REFINEDIR/$VERS/rdbms.sh -Cgrmi $HOME/bad-directory PJ01DB2 the following message appears:When executing $REFINEDIR/$VERS/rdbms.sh -c WWARN the following message appears: