Wednesday 29 July 2020

DUPLICATE KEY Error while replicating table in SLT



ERROR : 

Failed Initial Load
Initial load of table stopped
Error state in Data Transfer Monitor
Table stuck in Replication (Initial Load)
Error: Migration object Z_XXX_XXX is locked by user
Error: Cannot insert record in target system (duplicate key error)
Error: Failed to delete migration object for table XXX of mass transfer XXX
Error: Object Z_XXX_XXX of type Migration Object is already locked by user 
Error: 'Z_<TABLENAME>_<MT_ID>: Run aborted due to DUPLICATE KEY on <DATE> at <TIME>'


Resolution: 


Duplicate key errors can occur in the following situations:


  1. Data load job aborted after the commit on HANA database and before the data portion could be marked as in process.
  2. 'Load' status was manually reset (using the 'Expert Functions')
  3. It can also indicate that some of the data that's being transferred is already present in the target system. 
  4. HA (high availability) or failover testing or real-life scenario.

If the initial load of a table is interrupted then it can be expected to encounter the duplicate key error message. This is because the portion was inserted

Procedure 

1. Run transaction LTRS

2. Select the configuration that the table is in

3. Add the table to Performance Options

4. Under the Initial Load Options tab change Write Behavior to 'Array Modify'





5: Click on Save. 

6: Run transaction IUUC_SYNC_MON or LTRC
  1. Click on the Data Transfer Monitor Tab
  2. Select the table that's causing the duplicate key error
  3. Click the change table entry ICON


7. In the "Change Table Entries DMC_MT_TABLES" windows change 'Transfer Behavior' from '1' to '3'


8. Save


9. Reset failed flag by selecting the Expert Function 'Reset Load and Replication Status'



10. Fill in the table name, check Reset "Failed" Flag and Execute




If the error continues do the following steps:

Stop the Initial Load
Drop the table in the target system

Re-execute the Initial Load

Thanks