Reconcile Error (Underlying DBMS Violation of Primary Key)

3369
3
11-23-2011 08:23 AM
NickKenczka
New Contributor II
Hello All,

We are having a curious reconcile issue within our database.  I've attached the following error message I am getting when attempting reconcile with the QAQC version and my own version created from QAQC.  I don't really understand this error, but what I am getting out of it is that it is explaining that there is an issue with duplicate primary key values within the table from my version?  Note, the primary keys are the object ID and Global IDs so I have no control over these, obviously. 

Some background info on this table is that it is a table we manage that has the information for all subdivision, annexation, development plans, etc. and is a stand alone table at the root of the database.  The table is versioned, and the edits are being pushed to the base tables.  We are working in a SQL 2005 database.  If anyone can provide any sort of feedback on this error I thank you in advance.
0 Kudos
3 Replies
NickKenczka
New Contributor II
Was just wondering if anyone had any idea as to how I can resolve this issue.  Thanks in advance.
0 Kudos
ManojGarg
New Contributor II
Hi,

Since you are doing reconcile, that means this is a versioned table.
If correct then you mentioned you have primary key on objectid and global id.
What do you mean by global id ? is that not sde_state_id?

If this is not sde_state_id then primary key should be on objectid and sde_state_id.
When you try to reconcile, same row gets created in a new sde state id.. Since you are not having sde state id hence this might be the issue.
0 Kudos
BenLin
by
New Contributor III
Hi Nick,

Here is the solution for this primary key violation error.

1. Save all your users' edits and disconnect all your users from the SDE/SQL Server geodatabase.

2. From SQL Server Management Studio, create a full database backup.

3. From SDE server, run following command to identify any orphaned, duplicated records.
sdegdbrepair -o diagnose_tables -d SQLSERVER -D <database_name> -s <SQLSERVER_instance_name> -u <sysadmin_user> -p <password>

Note, you need to use your actual database settings to replace those <> values.

4. If you do see any orphaned, duplicated records from step 3, please run following command to fix those problems.
sdegdbrepair -o repair_tables -d SQLSERVER -D <database_name> -s <SQLSERVER_instance_name> -u <sysadmin_user> -p <password>

5. You can now try reconciling the problematic version again.

Thanks,
Ben
0 Kudos