Q Replication

Q Replication is a high-volume, low-latency replication solution that uses IBM® MQ message queues to transmit transactions between source and target databases or subsystems.

The Q Capture program reads the Db2® recovery log for changes to a source table that you specify. The program then sends transactions as messages over queues, where they are read and applied to targets by the Q Apply program. You can replicate data to Db2 targets, native Oracle targets, and federated targets.

Q replication offers several advantages:

Minimum latency
Changes are sent as soon as they are committed at the source and read from the log.
High-volume throughput
The Q Capture program can keep up with rapid changes at the source, and the multithreaded Q Apply program can keep up with the speed of the communication channel.
Minimum network traffic
Messages are sent using a compact format, and data-sending options allow you to transmit the minimum amount of data.
Asynchronous
The use of message queues allows the Q Apply program to receive transactions without having to connect to the source database or subsystem. If either of the replication programs is stopped, messages remain on queues to be processed whenever the program is ready. Because the messages are persistent by default, the source and target remain synchronized even in the event of a system or device failure.

Q Replication allows many different configurations. You can replicate between remote servers or within a single server. You can replicate changes in a single direction or in multiple directions. Replicating in multiple directions can be bidirectional (useful for managing standby or backup systems) or peer-to-peer (useful for synchronizing data on production systems).

To use Q Replication, you create the following types of objects:
  • Replication queue maps, which identify the MQ queues for sending and receiving data.
  • Q subscriptions, which identify options such as which rows and columns are replicated or published and options for loading target tables.
The following sections provide a quick overview of the three types of Q Replication:

Unidirectional replication

Unidirectional replication has the following characteristics:
  • Changes that occur at a source table are replicated over MQ queues to a target table or are passed as input parameters to a stored procedure to manipulate the data.
  • Changes that occur at the target table are not replicated back to the source table.
  • The target table typically is read-only, or is updated only by the Q Apply program.

Bidirectional replication

Bidirectional replication has the following characteristics:
  • Replication occurs between tables on two servers. Changes that are made to one copy of a table are replicated to a second copy of that table, and changes that are made to the second copy are replicated back to the first copy.
  • Updates on either of the servers are replicated to the other server.
  • Applications on any of the servers can update the same rows in those tables at the same time. However, there is little or no potential for the same data in the replicated tables to be updated simultaneously by both servers. Either the same row is updated by one server at a time, or one server updates only certain columns of data, and the other server updates the other columns.
  • You can choose which copy of the table wins if a conflict occurs.

Peer-to-peer replication

Peer-to-peer replication (also known as multimaster replication) has the following characteristics:
  • Replication occurs between tables on two or more servers.
  • Updates on any one server are replicated to all other associated servers that are involved in the peer-to-peer configuration.
  • Applications on any of the servers can update the same rows and columns in those tables at the same time.
  • All servers are equal peers with equal ownership of the data; no server is the "master" or source owner of the data.