When you finish setting up the replication system, test that replication works as intended.
CONNECT TO dbalias USER db2_user USING db2_user_ps
where dbalias is the cataloged alias of the primary database, db2_user is the primary database user, and db2_user_ps is the password.
CREATE TABLE PTAB1 (IDNO INTEGER NOT NULL, NAME VARCHAR(20), PRIMARY KEY(IDNO))
grant all on PTAB1 to public
pdb_setreptable PTAB1, mark go
insert into ptab1 values (1, 'Burt Gringlesby'); insert into ptab1 values (2, 'Douglas Wong'); insert into ptab1 values (3, 'Tom Servo'); insert into ptab1 values (4, 'Innes del Castillo'); insert into ptab1 values (5, 'Akiko Yokomoto'); commit;
rs_create_repdef ptab1 go Table/Procedure Name RepDef Name Status ------------------------ -------------- -------- <DB2UDBTableOwner>.PTAB1 "<repdefname>" Created (1 row affected)Record the name of the replication definition for use later.
CREATE TABLE <tableowner>.PTAB1 (IDNO INT PRIMARY KEY, NAME VARCHAR(20));
grant all privileges on <tableowner>.PTAB1 to public
isql –Usa –Psa_pass –SSAMPLE_RSIf you have not set up the sample Replication Server instance, enter your Replication Server instance name in place of SAMPLE_RS.
alter replication definition <repdefname> with replicate table named <tableowner>.ptab1 go
create subscription ptab1_sub for <repdefname> with replicate at rds.rdb without holdlock direct_load user puser password ppwd go
For information about using the create subscription command in direct_load materialization, see Replication Server Reference Manual.
check subscription ptab1_sub for <repdefname> with replicate at rds.rdb go
If there are errors, see Troubleshooting Subscription Problems.
insert into ptab1 values (10, 'Michel DeFrance'); insert into ptab1 values (11, 'Dirk Stringer'); commit;
check subscription ptab1_sub for <repdefname> with replicate at rds.rdb go Subscription ptab1_sub is VALID at the replicate.
SELECT * FROM <tableowner>.PTAB1