Adding tables to Data Gate on Cloud
From the dashboard, you can always add tables to your configured Db2 Data Gate instances.
Before you begin
The synchronization function requires that tables have a unique key. Therefore, you might need to add unique keys to some of your source tables. If the chosen key column is neither a primary key, nor a primary index, you must explicitly specify it as an informational unique constraint. This cannot be done in OpenShift®. You must alter or re-create the tables in Db2® for z/OS®.
About this task
- When you add a Db2 for z/OS source table to Data Gate on Cloud, an alias name is created for the target table.
In most cases, this alias has the same name as the source table, unless the schema name of the
source table starts with the string
SYS
, such as a user-created table named"SYSABC"."TABLETEST"
or a system catalog table like"SYSIBM"."SYSTABLES"
. In the latter case, a different alias name is chosen, in which the schema name of the alias starts with the prefixDG_
followed by the name of the Db2 subsystem that the source table resides in (the Db2 location name). To this string, an underscore character (_
) is added, followed by the original schema and table name. The reason is a limitation in Db2 Warehouse on Cloud, which does not allow alias names to start with the stringSYS
. For more information, see CREATE ALIAS statement. You find naming examples in the following table:Source table name Target alias name "SCHEMATEST"."TABLETEST"
"SCHEMATEST"."TABLETEST"
"SYSABC"."TABLETEST"
"DG_DB2A_SYSABC"."TABLETEST"
"SYSIBM"."SYSTABLES"
"DG_DB2A_SYSIBM"."SYSTABLES"
- Tables in the target database are Unicode tables. That is, tables to be created in the target
database are converted to Unicode if you select Db2 for z/OS tables in a different format. Different requirements
with regard to column widths are taken into account during the conversion. In many cases, the
converted (Unicode) tables need wider columns than the EBCDIC-encoded tables to avoid a truncation
of values. The column length of the Unicode column is calculated according to this formula:
MIN(max. column width, MAX(column width + fixed buffer, column width * buffer factor))
Suppose you have a VARCHAR column in an EBCDIC table. During the conversion to Unicode, the column width is determined as follows:
- The maximum length for Unicode VARCHAR columns is determined.
- The greater of the following two values is calculated:
- The length of the EBCDIC column plus a 10-byte buffer.
- The length of the EBCDIC columns multiplied by a buffer factor. However, this buffer factor is only applied to columns with a width greater than 10 characters.
- Finally, the maximum length for Unicode VARCHAR columns is compared with the maximum previously calculated, and the smaller of these two values is used as the Unicode column length. The resulting length after the conversion can be significantly greater than the original length.
- Tables must have a unique constraint (primary key or primary index). If such a key does not exist in the table or cannot be determined, you must redefine the table and specify such a key. The columns that you choose for the key must contain unique values or form such values when they are combined.
- If you update Db2 for z/OS tables by running the
LOAD utility, you must set the following keywords for the LOAD utility:
SHRLEVEL CHANGE
LOG YES
- You might have to reload or even remove tables from Data Gate on Cloud after an ALTER TABLE or ALTER TABLESPACE statement is applied in Db2 for z/OS.
- The Db2 source tables of your Data Gate on Cloud
replicas have an attribute named DATA CAPTURE. The attribute can carry the value Y or N (default),
for yes or no. When synchronization is enabled for a table, the DATA CAPTURE attribute of the table
is set to the value Y. Once set, this attribute value persists, even if the table is disabled at a
later time. Bear this in mind, especially if you run applications that use the DATA CAPTURE
attribute.
The DATA CAPTURE attribute is set by an ALTER TABLE statement, which is run as part of the SYSPROC.ACCEL_SET_TABLES_REPLICATION stored procedure. However, the attribute can only be set successfully if the ID of the user who runs the stored procedure has ALTER TABLE authorization. If this is not the case, a database administrator must set the attribute for all tables Db2 for z/OS.
The last bullet was not crossed out by Eirini. However, the option was crossed out previously, so logically, it also has to be deleted here.