Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Need to find Duplicate records in Target DB , which is not present in the Source DB

JhilDec 5 2024

Dear Experts,

We've migrated data from Source to Target Database by GoldenGate.

I am trying to find 4 records that are available on Target DB but not in Source DB.

I found 2 records on the target side, but am still unable to find another 2 records. I need some help.

Here the primary key is EMPLOYEE_BASIC_ID sequence based on both side.

Source 
========
select count(*) from HRMS2_EMPLOYEE_BASIC_DTLS;
COUNT(*)
----------
552256

Target 
========
SQL> select count(*) from HRMS2_EMPLOYEE_BASIC_DTLS;
COUNT(*)
----------
552260

>>


SQL> SELECT EMPLOYEE_ID, EMPLOYEE_BASIC_ID
FROM HRMS2_EMPLOYEE_BASIC_DTLS t
WHERE EMPLOYEE_ID IN (
SELECT EMPLOYEE_ID
FROM HRMS2_EMPLOYEE_BASIC_DTLS
GROUP BY EMPLOYEE_ID
HAVING COUNT(*) > 1
   )
 MINUS
SELECT EMPLOYEE_ID, EMPLOYEE_BASIC_ID
FROM HRMS2_EMPLOYEE_BASIC_DTLS@linkc;
EMPLOYEE_ID EMPLOYEE_BASIC_ID
----------- -----------------
 911242806            655059
 911256946            747730

>>

>> Source 
===========
SQL> SELECT EMPLOYEE_ID, EMPLOYEE_BASIC_ID  from HRMS2_EMPLOYEE_BASIC_DTLS
where EMPLOYEE_ID IN ('911242806','911256946');   
EMPLOYEE_ID EMPLOYEE_BASIC_ID
----------- -----------------
 911242806           1110393
 911256946           1110392

>>

>> Target : 
==========
SQL>  SELECT EMPLOYEE_ID, EMPLOYEE_BASIC_ID  from HRMS2_EMPLOYEE_BASIC_DTLS
where EMPLOYEE_ID IN ('911242806','911256946');  

EMPLOYEE_ID EMPLOYEE_BASIC_ID
----------- -----------------
 911242806            655059
 911242806           1110393    – Available on source DB
 911256946            747730     
 911256946           1110392    - Available on  source DB 

Thanks

Jhil

This post has been answered by Frank Kulash on Dec 5 2024
Jump to Answer
Comments
Post Details
Added on Dec 5 2024
5 comments
144 views