Getting DB2 Data From A to B
It's a fairly common challenge: you have an operational DB2 database (meaning, one that supports one or more of an organization's core business applications), and a query/reporting database, and you want to make sure that the data in the latter stays fairly current with respect to update actions (insert/update/delete) affecting data in the former. How should you address this challenge? The answer, of course, depends on a number of factors. In this post, I'll describe some data-change replication solutions that might be a good fit, given certain circumstances.
Often, development of an effective strategy for data-change replication begins with an understanding of the organization's priorities in this area. For one company, the priorities could be minimization of dollar cost and implementation time. In that case, one might opt to go with a trigger-driven approach. Database triggers provide some important benefits when the goal is a relatively low-cost replication solution that is up and running in a relatively short period of time:
Here are some of the things I like about the use of an MQ queue for captured data changes that will be applied on the target database system:
Often, development of an effective strategy for data-change replication begins with an understanding of the organization's priorities in this area. For one company, the priorities could be minimization of dollar cost and implementation time. In that case, one might opt to go with a trigger-driven approach. Database triggers provide some important benefits when the goal is a relatively low-cost replication solution that is up and running in a relatively short period of time:
- You don't have to buy them - Trigger functionality is built into DB2.
- You don't have to alter existing source-data-change programs - The triggers are fired by what these programs are already doing.
- They provide a lot of flexibility - A trigger can initiate an action before or after the triggering data change operation has taken effect. The triggered action can be anything doable by way of an SQL statement or statements, and since a stored procedure call is an SQL statement, you can do most anything programmatically possible using a trigger.
Here are some of the things I like about the use of an MQ queue for captured data changes that will be applied on the target database system:
- MQ provides assured delivery of messages (such as those containing captured source-system data changes) from one location to another (or to several target locations through publish and subscribe functionality, also known as pub/sub).
- An MQ queue can be configured as a recoverable resource, so that even if a server on which a queue is located crashes, no messages will be lost.
- If a burst of source-system data changes causes messages to be placed on a queue (via triggers, for example) faster than they can be taken off the queue by target-system processes, that's not a problem - the queue depth just increases for a while, until the PUT (i.e., the placing of messages on the queue) and GET activity (referring to the retrieval of messages from the queue) returns to a state of equilibrium.
- MQ runs on just about any server platform, under most all of the major operating systems.
- An MQ GET can be executed as a "destructive read" (i.e., a message can be simultaneously retrieved from and removed from a queue), providing a very CPU-efficient message delete capability.
- MQ messages can be processed on a FIFO basis (first in, first out) - important if the order of data change application on the target system is important.
- Built-in DB2 SQL functions such as MQSEND and MQRECEIVE make it much easier to code triggers that interact with MQ.
- DataMirror (now an IBM company)
- Informatica
- GoldenGate
2 Comments:
I came accross your article which comes directly to the need that I currently have, the problem is: How to implement it?
I am looking for the answer on the internet with little luck, even the IBM manual doesn't answer that question, so, I would appreciate if you could point me in the right direction.
Very good article by the way.
Apologies for the very late response - I rarely log into this blog these days (my last post to this blog was in 2010), and somehow I either did not receive a notice about your comment, or I overlooked that notice.
If you are asking how to implement data-change replication for a source Db2 for z/OS system, you can do that using an IBM product called IBM InfoSphere Data Replication (information at https://www.ibm.com/products/infosphere-data-replication). If you want to implement a "do-it-yourself" data replication process using Db2 triggers, you can find information about basic triggers at https://www.ibm.com/docs/en/db2-for-zos/12?topic=statements-create-trigger-basic. Information about advanced triggers can be found at https://www.ibm.com/docs/en/db2-for-zos/12?topic=statements-create-trigger-advanced.
Robert
Post a Comment
Subscribe to Post Comments [Atom]
<< Home