Help Q Replication and Event Publishing

Sample ASNCLP scripts for setting up peer-to-peer Q Replication (two servers)

This sample contains two ASNCLP scripts for setting up a peer-to-peer Q Replication environment with two servers. The first script generates commands to create WebSphere® MQ objects at both systems. The second script creates Q Capture and Q Apply control tables at both servers, replication queue maps in both directions, and two peer-to-peer Q subscriptions.

The scenario involves two databases, SAMPLE and SAMPLPEER. One table, DEPARTMENT, will be replicated in both directions between the two databases.

You can copy the scripts to a text file, modify the values, and run the scripts by using the ASNCLP -f filename command. First:

Prerequisite: The scripts require the replication administration tools to be at Version 9.7 Fix Pack 4.

ASNCLP script 1: Create WebSphere MQ objects

##################################################
ASNCLP SESSION SET TO Q REPLICATION;

CREATE MQ SCRIPT RUN NOW
CONFIG TYPE P
MQSERVER 1 NAME SAMPLE MQHOST "9.30.54.118",
MQSERVER 2 NAME SAMPLPEER MQHOST "9.30.54.119";

QUIT;
##################################################
Notes: The CREATE MQ SCRIPT command generates two shell script files for Linux and UNIX systems (qrepl.sample.mq_aixlinux.sh and qrepl.samplpeer.mq_aixlinux.sh) and two batch files for Windows systems (qrepl.sample.mq_windows.bat and qrepl.samplpeer.mq_windows.bat). If you run the ASNCLP program on the same system as SAMPLE or SAMPLPEER, the RUN NOW option prompts the ASNCLP program to run the batch files or shell scripts to define the queue manager, queues, and other WebSphere MQ objects for that system. If the ASNCLP program is remote from either of the databases, you must run the appropriate batch file or shell script at these systems.

ASNCLP script 2: Set up Q Replication

##################################################
ASNCLP SESSION SET TO Q REPLICATION;
SET PEER NODE 1 SERVER DBALIAS SAMPLE ID db2admin PASSWORD "passw0rd" SCHEMA ASN;
SET PEER NODE 2 SERVER DBALIAS SAMPLPEER ID db2admin PASSWORD "passw0rd" SCHEMA ASN;
SET RUN SCRIPT NOW STOP ON SQL ERROR ON;

CREATE CONTROL TABLES FOR NODE 1;
CREATE CONTROL TABLES FOR NODE 2;

CREATE REPLQMAP SAMPLE_TO_SAMPLPEER (NODE 1, NODE 2);
CREATE REPLQMAP SAMPLPEER_TO_SAMPLE (NODE 2, NODE 1);

SET TABLES (SAMPLE.ASN.SMITH.DEPARTMENT);

CREATE QSUB SUBTYPE P;

QUIT;
##################################################
Notes: The commands in this script perform the following actions:
  • The SET PEER NODE commands specify the paired Q Capture and Q Apply servers at the SAMPLE and SAMPLPEER databases.
  • The SET RUN SCRIPT NOW option prompts the ASNCLP program to generate and run the SQL to create all objects.
  • The CREATE CONTROL TABLES FOR commands use the NODE 1 and NODE 2 keywords to prompt the ASNCLP program to create both Q Capture and Q Apply control tables at each server.
  • In the CREATE REPLQMAP commands, the (NODE 1, NODE 2) and (NODE 2, NODE 1) syntax creates queue maps in both directions.
  • For both the control tables and queue maps, the ASNCLP program by default uses the queue managers, queues, and other objects that were defined by the CREATE MQ SCRIPT command.
  • The SET TABLES command specifies one table, SMITH.DEPARTMENT, at the SAMPLE database. This provides enough information to generate SQL statements for creating a matching table at SAMPLPEER.


Send your feedback | Information roadmap | The Q+SQL Replication Forum

Update icon Last updated: 2013-10-25