Solved

dprop processing failed from Staging to production with below error

Posted on 2013-10-22
7
343 Views
Last Modified: 2014-02-01
Hello,

One of the sub-sets fail with the below error in the Trace files.

Please help me resolve this issue

*** SQL ERROR ***:  SQL0803N  One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "WCSUSR.ESTIM_WORKFLOW" from having duplicate values for the index key.  SQLSTATE=23505
0
Comment
Question by:jmartin_v
  • 3
  • 2
7 Comments
 
LVL 45

Assisted Solution

by:Kdo
Kdo earned 500 total points
ID: 39593920
Hi jmartin,

The message is fairly generic, but it's easy to track down the cause.  Using this as a template, plug in the key values from the error message:

SELECT INDNAME, INDSCHEMA
  FROM SYSCAT.INDEXES
  WHERE IID = <index-id>
  AND TABSCHEMA = 'schema'
  AND TABNAME = 'table'

Open in new window


becomes:

SELECT INDNAME, INDSCHEMA
  FROM SYSCAT.INDEXES
  WHERE IID = 1
  AND TABSCHEMA = 'WCUSR'
  AND TABNAME = 'ESTIM_WORKFLOW'

Open in new window


That will identify the unique index that caused the exception.  Then you need to check your SQL to see why your application was trying to insert duplicate values.  Either an INSERT or UPDATE statement could be at fault.


Good Luck,
Kent
0
 

Author Comment

by:jmartin_v
ID: 39594370
Hi Kent,

Thanks for the information, I got the index which was causing the exception.

I am not trying to manually insert/update the records. While Replicating from staging to production, I am getting this error. How can I avoid it? Due to this the entire subscription-set is failing.
0
 
LVL 45

Accepted Solution

by:
Kdo earned 500 total points
ID: 39594411
If you're getting this error on the replication system, the data already exists there.  I can only speculate, but there are several ways to generate this error.

-- Identity columns can be problematic when moving data from one database to another.  They are especially aggravating if the sequence is broken by altering the identity with a new start number, increment, etc.

That said, DB2 doesn't check for duplicates in the identity column.  If the error is occurring on the identity column, it's because there is a unique index (scalar or composite) the includes the identity column.  It's still the index validation check that is throwing the error.

-- Is the replication process a standard product or are you trying to replicate the data with your own processes?

It could be that several updates have to occur in the same transaction, (or in separate transactions) to be successful.  Your processes may not be taking that into account.

-- Are all triggers being accounted for?

The replication may require that the trigger be run.  It could also be that the trigger be NOT run since the replication process is copying data and the trigger on the production system would have left the data in the correct state.


What column is throwing the exception?  And how is the column defined?
0
 

Author Comment

by:jmartin_v
ID: 39596309
Kdo,

there are 3 columns (Not Null)  defined in the index. there are no identity columns in this table.

Using standard SQL replication process to replicate the data,
0
 
LVL 45

Expert Comment

by:Kdo
ID: 39597574
Have you had any system issues?  Outages, errors, etc.  

It's really odd that the replication process would encounter duplicate keys.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now