Solved

dprop processing failed from Staging to production with below error

Posted on 2013-10-22
7
349 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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 (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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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