You pair source tables with targets by defining Q
subscriptions.
When you create a Q subscription, you specify the following primary
attributes:
- The source server and source table
- The source server can be a DB2® server
that contains at least one set of Q Capture control tables, an Oracle
database, or a nonrelational databaase with InfoSphere® Classic Replication Server
for z/OS®. You can use a DB2 or
Oracle relational table on a source server as your source table. For
Classic replication, you can use tables or views on the nonrelational
database.
- The target server and target table or stored procedure
You can replicate data to DB2 tables,
federated tables, or a stored procedure on a DB2 server.
If
you need to transform replicated data, you can use a stored procedure
as a target or you can use SQL column expressions that are run by
the Q Apply program. If you want to keep a history of what changed
at the source, you can use a consistent-change-data (CCD) table as
a target.
- Which source columns to replicate to the target table or stored
procedure
- You can subset the columns that you replicate from the source.
- How to map the source columns to the target columns or parameters
in a stored procedure
- If your target table exists in the target location, you tell Q
Replication how the selected columns in your source table correspond
to the columns in the target table. If you want Q Replication to create
the target table for you, the selected source columns are automatically
mapped to the columns in the target table.
If you are replicating
to a stored procedure, you tell Q Replication how the selected columns
in your source table correspond to the parameters in your stored procedure.
- A predicate for replicating a subset of rows to the target table
- You can subset the rows that you replicate from the source by
using a predicate. A predicate limits the rows that are returned,
like a WHERE clause in a SQL statement. In Classic replication,
you must define views on tables to accomplish row filtering.
- The method of loading the target table
- In most cases, the data from the source table is loaded into the
target table so that the target table is identical to the source table
before replication begins. Q Replication allows for two methods of
loading a target table after you start a Q subscription: automatic
loads and manual loads.
For automatic loads, the Q Apply program
manages the loading of target tables. The Q Apply program calls one
utility or a pair of utilities to perform the load. You can tell the
Q Apply program to call the LOAD FROM CURSOR option of the LOAD utility,
the EXPORT and LOAD utilities, or the EXPORT and IMPORT utilities,
depending on the platform on which the Q Apply program is running.
You can also tell the Q Apply program to determine which of these
options is most appropriate for the Q subscription.
For manual
loads, you handle the loading of target tables, and then signal the
replication programs when loading is done.
- The WebSphere® MQ message queues to use for
transporting messages
- The Q Capture program puts messages on a queue called a send
queue. The Q Apply program receives the messages on a queue
called a receive queue. (These names are used only in
Q Replication, not in WebSphere MQ.) You choose
a replication queue map to tell Q Replication which send
queue and receive queue you want to use for the messages for your
Q subscription.
The following figure shows the parts of a Q subscription in a simple
configuration in Q Replication.
Figure 1. Creating a Q subscription.
You
map sources to targets by creating Q subscriptions. One Q subscription
maps one source table to one target table. Data for the Q subscription
is replicated across a send queue and a receive queue, both of which
are part of a replication queue map.