Adding existing columns to a Q subscription (unidirectional replication)
You can add existing columns from the source table to a unidirectional Q subscription while the replication programs are running. If the columns are not existing and your servers are at Version 10.1 or later, you use a different procedure.
Before you begin
- The Q subscription that the columns are being added to must be in A (active) state.
- Linux, UNIX, Windows: If the data type of the column is LONG VARCHAR or GRAPHIC, the source database or subsystem must be configured with DATA CAPTURE CHANGES INCLUDE VARCHAR COLUMNS.
Restrictions
- For pre-V12 Db2 for z/OS: If you add a column with a non-system default, for example ALTER TABLE OEUSR01.SRC_TABLE ADD COLUMN N01 CHAR(1) NOT NULL WITH DEFAULT 'Y', and then update that column with the system default value, the column does not replicate until you perform a REORG on the source table space. All other values replicate. For more information about the need for REORG, see When replication requires table space REORG after ALTER TABLE (z/OS).
- If you are adding more than 20 columns, you must issue a Db2 COMMIT statement after 20 ALTER ADD COLUMN operations at the source table or after inserting 20 ADDCOL signals. To avoid previous issues with ALTER ADD operations that exceed 20 columns, apply APAR PI88530.
- Federated targets: To add columns to an existing Q subscription, you can use the ADDCOL signal but you must drop the Q subscription and recreate it after you alter the target table because you cannot add columns to a nickname.
- The target cannot be a stored procedure.
About this task
When you insert the signal at the Q Capture server, the column is automatically added to the target table if you did not already add it. If you want to add multiple columns to a Q subscription, you insert one signal for each new column. You can add multiple columns in a single transaction. The Q Capture program can be stopped when you insert the signals and it will read them from the log when it restarts.
If you let the replication programs automatically add new columns to the target table it helps ensure that they match the columns at the source. Columns are added to the target table with the same data type, null characteristic, and default value as the matching columns in the source table. You can specify a different name for the target column if you use the ALTER ADD COLUMN command in the ASNCLP command-line program or an ADDCOL signal.
Procedure
Method | Description |
---|---|
ASNCLP command-line program. | Use the ALTER ADD COLUMN command. For example, the following
command adds the column BONUS to the DEPARTMENT0001 Q subscription:
|
Q Replication Dashboard | On the Subscriptions tab, select a Q subscriptions from the table and click | .
SQL | Use a command prompt or one of the Db2® command-line tools to insert an ADDCOL signal
into the IBMQREP_SIGNAL table at the Q Capture server. For example:
|