Solved

dprop processing failed from Staging to production with below error

Posted on 2013-10-22
7
350 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:Kent Olsen
Kent Olsen 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:
Kent Olsen 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:Kent Olsen
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

679 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