How to Use handlecollisions in Oracle goldengate

Source: Internet
Author: User

Handlecollisions is a replicat process parameter, which is mainly used in initial load. When this parameter is used in the replicat process
If data integrity problems exist in the environment (such as missing rows or repeated insert operations during update and delete operations), the replicat process can continue to process
Data.

If the handlecollisions parameter is used, the replicat process processes the data as follows:
Missing updates are ignored.
Missing deletes are ignored.
Duplicate inserts are turned into updates.

To use the handlecollisions parameter, you only need to add this parameter to the replicat process parameter file and restart the replicat process.
To take effect.

You can use the handlecollisions parameter for a specific table, or use this parameter globally.

With the send command, we can also dynamically enable the handlecollisions parameter without stopping the replicat process. The command is as follows:

Ggsci> send replicat <Name>, handlecollisions [<owner. table_name>]

Run the following send command to check whether the handlecollisions parameter is Enabled:
Send replicat <Name>, report handlecollisions [<owner. table_name>]

Example 1 the following enables handlecollisions for all MAP statements in the parameter file.
Handlecollisions
Map hr. EMP, target HR. EMP;
Map hr. job_hist, target HR. job_hist;
Map hr. Dep, target HR. Dep;
Map hr. Country, target HR. Country;

Example 2 The following enables handlecollisions for some map statements while disabling it
Others.
Handlecollisions
Map hr. EMP, target HR. EMP;
Map hr. job_hist, target HR. job_hist;
Nohandlecollisions
Map hr. Dep, target HR. Dep;
Map hr. Country, target HR. Country;

Example 3 The following shows a combination of global and map-level use. The map Specification
Overrides the global specification for the specified tables.
Handlecollisions
Map hr. EMP, target HR. EMP;
Map hr. job_hist, target HR. job_hist;
Map hr. Dep, target HR. Dep, nohandlecollisions;
Map hr. Country, target HR. Country, nohandlecollisions;

Oracle does not recommend that you always enable the handlecollisions parameter because it may cause data inconsistency in the target database. Even if data is missing or duplicated,
The replicat process continues to process data in the trail. Handlecollisions is mainly used after initial load, the application on the source database is still running
Goldengate is still used to start replicat when it captures data changes of the application. We need
The handlecollisions parameter is also used when the trail file is rolled back.

In goldengate 8.0.2.1 and later versions, when the replicat process is stopped, we can see Duplicates in the replicat statistics or report file.
The number of insert operation conflicts.

Handlecollisions and keycols

If you perform the DML operation on a table without a primary key or a unique index, goldengate can process such DML and
The processing method of an index is different because keycols cannot directly replace the primary key. When a record with the same keycols value is inserted, goldengate applies to these records.
The handlecollisions rule does not apply to these records.

Handlecollisions and pkupdates

If the Missing Update is a primary key update, replicat will try to insert this record instead of ignoring this operation. But when replicat tries to insert, the record to be inserted
The trail file is not a complete image. To obtain the complete image of the primary key update, add the following parameters to the extract process and restart the extract process.
Make it take effect:

Fetchoptions fetchpkupdatecols

For reprint, please indicate the author's source and original article link:

Http://blog.csdn.net/xiangsir/article/details/8714965

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.