Error: ORA-00001: unique constraint (SDE.GDB_OC_UC) violated
When creating a new feature class or table in an ArcSDE geodatabase, the following error message may occur:
"ORA-00001: unique constraint (SDE.GDB_OC_UC) violated".
This error occurs when the following are both true:
1. A table or feature class with the same name was previously created in the user's schema using ArcGIS Desktop.
2. The original table or feature class was deleted using the ArcSDE Administrator commands 'SDELAYER -o delete' or 'SDETABLE -o delete'.
When a table or feature class is created by way of ArcGIS Desktop, a row for that object is created in the GDB_OBJECTCLASSES table. This table exists in the ArcSDE metadata repository and is owned by the SDE user. There is a unique constraint on this table that prevents the creation of objects that have the same name and owner.
The ArcSDE administrator commands were created prior to the implementation of the geodatabase in ArcSDE, and thus do not manage the GDB_* tables in the ArcSDE metadata repository. Therefore, if an object that has an entry in any of the GDB_* tables is deleted by way of the Administrator commands, those entries will not be deleted from the GDB_* tables.
To prevent this situation from occurring, use ArcCatalog to delete any objects in ArcSDE that were created by way of ArcGIS Desktop.
Solution or Workaround
The solution is to re-create a table in the RDBMS having the same name and owner as the original, and then delete it using ArcCatalog. This cleans up any existing entries in the GDB_* tables for the original object.
- Create a new table in ArcSDE having the same name, owner, and database as the original table or feature class using the 'SDETABLE -o create' administrator command:
sdetable -o create -t <name of original table> -d "test string(10)" -s <server name> -i <service name or ArcSDE port #> -u <owner name> -p <password>
- Connect as the owner of the new table in ArcCatalog.
- Right-click on the table and select 'Delete'.
- Now a new table or feature class can be created that has the same name as the original.