ODI refresh failed after modifying primary key solution

Source: Internet
Author: User

The ODI incremental refresh, after modifying the primary key value, causes the refresh to fail. Workaround: Use columns with fixed values in the table as the basis column for incremental refreshes.

The demo is as follows:

As above, the source and target tables have the same records. The source table primary key information is now modified

After performing a data synchronization refresh, the target table data is as follows

found that when the source table is in the update primary key, after the synchronization is performed, a new record is inserted into the target table, and the original key value record remains in the library.

Solution: Find a column (a set of) fixed fields from the source table, and establish the primary key in the target table as a fixed field in the source table as the basis for the update.

As follows:

The source table ORDTASK2, the primary key is ordno,methodcode; when we do data integration, we think Origrec is unique, and we add a unique index with NOT NULL as the constraint. The value never changes (and the primary key corresponding to the target table corresponds to ORDTASK2.ORIGREC).

Target table ORDTASK3, primary key is Origrec

Enable logging for the source table and add it to CDC, for example, with a small clock in front of ORDTASK2

At this point you need to modify the trigger above the ORDTASK2, and the log information related to several tables, views.

Modify the Log table first

Cancels the original defined Ordno, Methodcode, and modifies to Origrec. Next, modify the trigger

Write Origrec to the log table Jtask2, and then modify Jv$dordtask2, Jvtask2

After the above modification operation, the data synchronization operation is basically no problem, next create the mapping ORDTASK2

Test data synchronization

Add a piece of data to ORDTSK2

, this data change has been captured in the ORDTASK2 log table. Perform data synchronization

found that the ORDTASK3 target table has been synchronized.

Modify non-primary key testno to "TN00100"

Perform synchronization

Data is synchronized

Update primary key value Ordno modified to "A0010"

Perform synchronization

ORDTASK3 data has been refreshed

Modify primary key + non-primary key

Perform synchronization

Delete Data test

Delete data in ORDTASK2

Perform synchronization

Sync succeeded!

ODI refresh failed after modifying primary key solution

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.