Database Message | UNIQUE Constraint Failed: Object.Dstdn (or Database Error | 19: Column Joinquery Is Not Unique)

Created: 2012-04-20 08:09:59
Modified: 2022-03-23 11:39:51
Tags: Errors Troubleshooting UnitySync

In your Error Summary, you see:

UNIQUE constraint failed: obje | 128

Run your connection again with the Log File level set to 3-Detailed, then search that log for unique constraint. You will find the message:

Database Message | UNIQUE constraint failed: object.dstdn

There may be one of several reasons for this error.

Sync/Join Mode set to Create

This error may occur when using a custom DN mapping that utilizes givenName and sn or displayName or similar.

dn=cn=^givenname^.^sn^, ~struct~

Using name parts for your DN mapping can cause issues with duplicate objects attempting to add. Let’s say we encounter this issue with Joe Smith.

  1. As the Sync processes, the first Joe.Smith is created on the Destination.
  2. Then, another, but different, Joe.Smith object is added to the Source. A subsequent Sync tries to Add the new object, but returns the LDAP message Add Exists.
  3. So, the Sync attempts to Modify the existing object.
  4. During the Modify attempt, however, the Sync detects that the DN already exists in the database (.db) files. The result is the UNIQUE Constraint Failed error.

To correct this issue, we strongly recommend revisiting your DN mapping and altering it to include a value that will always be unique. Our default mapping utilizes mail as this attribute value tends to be unique on the Source, preventing duplicates (or attempts to duplicate) objects on the Destination.

If you must use name parts, also consider adding a unique attribute such as mail or employeeID or the like, to help prevent attempted duplicates.

Sync/Join Mode set to Both or Join

Note: When Both is set, this error may alternatively be logged as:
Database Error | 19: column joinquery is not unique

This error may occur when Create/Join is enabled. This error indicates the Sync phase has detected a source object with a duplicate source index, so a previously synced object has the same index value. A Log File level 3-Detailed Sync log will show the index value that is duplicated.

For example, if the index join query is (mail=^mail^)

Database Error | 19
Database Message | UNIQUE constraint failed: object.joinquery
db srcdn | CN=zelda Jones,OU=testjq,DC=2k10,DC=test
db srcindex | 16434bd343d218439527388820bf8385
db joinquery dec | (mail=jones@domain.com)
db joinquery | (mail=\6a\6f\6e\65\73\40\64\6f\6d\61\69\6e\2e\63\6f\6d)
db dstdn | cn=jones@domain.com,ou=testjq-b,dc=2k10,dc=test
db crc | 1
db flag | 1

Error Summary : 09/04/15 09:04:47
UNIQUE constraint failed: obje | 1
Process Returned: 1 Process Exited on Error: 1

The error output indicates the query causing the duplicate:
db joinquery dec | (mail=jones@domain.com)

The error output indicates the problem object:
db srcdn | CN=zelda Jones,OU=testjq,DC=2k10,DC=test

Search your ldif.txt for all instances of the value (jones@domain.com). You should be able to identify all instances of Source objects with the identical value. In order for both of these objects to Sync, one of their values must be changed and this must be done on your Source.

The only other option, is to alter the Join query string you are using for your connection. If you are using an attribute in your Join query that may be duplicated on the Source, you will see this error when you encounter duplicate data. Technical support will be happy to help you evaluate your Join query string to determine if changes would help alleviate this error.

Note: Very occasionally, this error is a result of database corruption. You may try a Sync Recovery Procedure to see if it corrects the issue but please be aware that you run the risk of losing unprocessed Deletes since the last Sync when performing the Recovery Procedure.

Share this article:
Knowledgebase

Directory
  1. Directify - Self Service

  2. Mimic - Replication

  3. UnitySync - Sync
Password
  1. emPass - Sync
Obsolete
  1. Profiler
  2. SimpleSync