A brief overview of data replication technology for DB2 databases (1)

Source: Internet
Author: User
Tags ibm database

What is Data Replication?

Data replication is to copy the specified data in the source database to the target database to ensure the synchronization of the specified data in the source database and the target database is consistent ).

Basic Concepts

CD table: change data tables: used to temporarily store tables for changing data. It generally contains the columns to capture changes and some control columns.

For example, the user-specified column to capture changes

CREATE  TABLE  DEPARTMENT (DEPTNO …, <--DEPTNAME …, <--MGRNO …,ADMRDEPT …,LOCATION …)

Source table

CREATE  TABLE  CD20030805296530(IBMSNAP_UOWID …,IBMSNAP_INTENTSEQ…,IBMSNAP_OPERATION …,DEPTNO…, <--DEPTNAME …) <--

CD table

DB2 Log Type:

Archive cyclic logs:

DB2 Data Replication Components

DB2 DataPropagator consists of three parts: Management Interface, change capture mechanism, and Application

Note: The application Apply program here is different from what we usually call an application. Unless otherwise stated in this article, "application" refers to the DB2 Data Replication component.

Management Interface

We mainly use it to create control tables for storing replication standards. There are multiple types of control tables used to store information such as the tables and columns to be copied. We will discuss them carefully later. We can use two management interfaces:

1. DB2 Control CenterDB2 Control Center) can only replicate data between DB2 servers

2. DataJoiner Replication Administration (DJRA) can contain data Replication for non-IBM databases. This article will not detail)

For specific control table types, you can view the file "SQLLIB \ samples \ repl \ dpcntl. udb". The control tables involved in this article include ASN. IBMSNAP_REGISTER and ASN. IBMSNAP_UOW.

Change capture mechanism

After the replication environment is created, this mechanism is used to capture changes to the source database and save the changes to the CD table temporarily. The DB2 Data Replication solution provides two data capturing mechanisms:

1. Capture programs for the DB2 source table

When the source is a DB2 table, the capturing program captures changes made on the source. The capturing program uses database logs to capture changes that occur on the source database and temporarily stores the changes in the table. The capture program runs on the source server.

2. Capture triggers for non-IBM database source tables are not discussed in detail in this article)

Applications

After the capturing program temporarily stores changes to the source table in the CD table, the application reads the changes to the source database from these tables and applies the changes to the target database, or directly copy the data from the source database to the target database.

1. When the replication environment is just set up, there is an initialization process in which the application will directly read data from the source table or view to initialize the target table. Then, if you want to copy the changes, the application will read the changed data from the temporary storage from the CD table and apply it to the target table.

2. applications usually run on the target server, but they can also run on any server on the network that can be connected to the source, control, and target server. Multiple Application Instances can run on the same or different servers.

3. Each application is associated with a control server that contains a control table. The control table contains the definition of the reservation set. The control table can be used by multiple application instances. For example, if you have one source server and two target servers, you can run applications on each target server separately. The two application instances can share the control table. The control table has specific information associated with each application instance.

How to communicate with each replication component

Each replication component is independent of each other, so they rely on the information in the control table for communication. Capture, the application updates the control table to indicate the replication process and coordinate the change process.

For data replication between DB2, the capturing program captures data changes in the source table by reading logs on the source server. The capturing program then puts the changed data in the table called "Change Data CD.

Each time an application copies data to the target database, the content of the target database will reflect the changes made to the source database. The application is implemented through the transaction accumulated since the last update of the target as the application knows, that is, only the changes that have not been applied by the application.

Log-based communication

The capturing program uses some control tables to record changes that occur on the source database, and applications use the values in these control tables to detect what needs to be copied to the target database.

Important: If the application does not notify the capturing program, the capturing program does not capture any change information. Similarly, unless you define a replication source and associate it with the reservation set, the application will not notify the capture program to start capturing changes.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.