Replicating IBM Db2 data
You can replicate data from IBM Db2 to other databases with Data Replication.
To set up replication for Db2, first configure your Db2 instance, and then add a connection to it in a project.
Supported versions
IBM Db2 version 11.5.x for Linux, UNIX, and Windows platforms
Restrictions
-
You can replicate only some IBM Db2 data types. For more information, see Supported IBM Db2 data types.
-
You can only replicate from IBM Db2 UTF8 instances.
-
IBM Db2 can only be used as a source data store for Data Replication.
Configuring IBM Db2 as a source
To configure Db2 as a source database for Data Replication:
-
Data Replication replicates from Db2 row-organized tables only. Verify that the tables you intend to replicate from are row-organized and not column-organized. In this example, the 'R' in column TABLEORG indicates that table SALES_ROW is row-organized and can be replicated.
SELECT tabname, tableorg FROM SYSCAT.TABLES WHERE tabname like 'SALES%' TABNAME TABLEORG ------------------------------- -------- SALES_COL C SALES_ROW R 2 record(s) selected.
-
Configure database logging parameters. Enable log retention for each database that you intend to use for replication. If you want to replicate table structure changes, enable DDL statement logging as well.
CALL SYSPROC.ADMIN_CMD ('UPDATE DATABASE CONFIGURATION USING LOG_DDL_STMTS YES')
-
Complete the following requirements:
-
Set table DATA CAPTURE CHANGES to YES. In order for Data Replication to replicate schemas and tables, the tables need to have DATA CAPTURE CHANGES set to YES. You can enable this manually for each table you wish to replicate, if the Db2 user account you specify in your connection has both SYSADM and DBADM authorities.
Example:
ALTER TABLE "BANKING"."CREDIT_SCORE" DATA CAPTURE CHANGES;
-
Data Replication requires that the table must have a column designated as the primary key.
Example:
ALTER TABLE "BANKING"."CREDIT_SCORE" ADD PRIMARY KEY ("ID") ENFORCED;
-
Connecting to Db2 in a project
To connect to IBM Db2 in a project in Cloud Pak for Data, see IBM Db2 connection. You can use SSL with self-signed certificates to encrypt connections to your Db2 database.
Creating a replication asset with IBM Db2
To create a Data Replication asset:
-
Click the Assets tab in the project.
-
Click New asset > Replicate data.
-
Enter a name.
-
Click Connections.
-
On the Source options page, select an existing IBM Db2 from the list of connections or click Add connection to create a new connection. You can optionally configure Db2 connections to use IBM Db2 pureScale to scale your database as follows:
- Select the Db2 pureScale enviroment option.
- Specify the member ID of the database server you want to add to your enviroment. By default the ID is set to 0.
-
On the Target options page, select a target connection from the list, or click Add Connection to create a new connection.
-
On the Review page, review the summary, then click Create.
Next step
Parent topic: Supported Data Replication connections