简体   繁体   中英

Merge data from two databases in DB2

I have a new requirement with me in which I have to merge data of two identical DB2 databases(around 200 tables in each) keeping all the unique rows from the both. these two databases are identical as they are from two different environment of same application and now clients wants them to merge together.

These tables are business tables, so they always have single records on the basis of Primary keys and foreign keys. which makes that there will be good chances of having the 2 records with same primary key when we will try to merge the databases. We only need to keep only single record out of these two records.

I am not getting a way to start doing this or how to proceed any Idea or approach will help, thanks in advance.

I have to prepare some set of JCLs which can use DB2 utilities, SQL or COBOL program to achieve this, but I am not getting a way to start doing this or how to proceed .. any Idea or approach will help, thanks in advance.

Both Syncsort and DFSORT have match merging capabilities, look for the JOIN control statement in the documentation. Use your shop's DB2 unload utility to extract the data from each table into a flat file, then use your shop's SORT utility to match merge the two versions of each table, outputting matched records to one file, unmatched records from the first version to another file, and unmatched records from the second version to a third file.

This isn't difficult, just tedious.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM