1

Some users have reported an error when attempting to copy and paste feature classes from an enterprise geodatabase (See Image #1).

After looking at the domains in the geodatabase, we see that the correct number of domains is present in ArcGIS Pro, but absent in Arc Catalog which you can see in Image #2.

The same code snippet was run in ArcGIS Pro & Arc Catalog on the same geodatabase with different results.

I've never encountered this before, has anyone seen anything like this?

gdb = r'PathToGDB'
arcpy.env.workspace = gdb
print len(arcpy.da.ListDomains())

Image1 Image2

4
  • Rather than copy 'n' paste have you tried running the featureclass to featureclass tool to carry out the copy?
    – Hornbydd
    Jul 11, 2022 at 21:08
  • The feature class to geodatabase export tool works just fine for copy/pasting feature classes because it doesn't copy the associated domains. The copy/paste option does take all the relationships and domains, and that's where we're getting this error. For some reason Arc Catalog isn't seeing certain domains and I can't figure out why.
    – Schack
    Jul 11, 2022 at 21:20
  • Is ArcMap being given that long fully qualified domain name plus a long domain name? I would think it would ignore the database section of the name, but maybe not.
    – danak
    Jul 11, 2022 at 23:07
  • I asked about Feature Class to Feature Class tool not Feature Class To Geodatabase tool...
    – Hornbydd
    Jul 12, 2022 at 9:20

1 Answer 1

0

After working with an ESRI representative, we found there were orphan domains in the geodatabase.

The procedure below details how to generate a list of orphaned domains for a geodatabase. To eliminate uncertainty, it’s best to remove all domains from every feature class and table and then delete all domains using arcatalog/arcpy. After this is done, we check in SQL again for any remaining domains and delete them to ensure there is nothing left.

1.) Select all domains currently in geodatabase using SQL:

SELECT * FROM [sde].[GDB_ITEMS] Where Type = '8C368B12-A12E-4C7E-9638-C9C64E69E98F'

2.) Compare the SQL domains with the arcpy domains:

gdb = r'YourGeodatabasePath'
arcpy.env.workspace = gdb
domains = arcpy.da.ListDomains()
sqlDomains = ('List of domains generated in SQL')
stringDomains = []

for domain in domains:
    stringDomains.append(str(domain.name))

for domain in sqlDomains:
    if domain not in stringDomains:
        print domain

To remove and delete all domains in arcpy/arccatalog:

## Removing & deleting all domains in a gdb
import arcpy, traceback
gdb = r'YourGeodatabasePath'
arcpy.env.workspace = gdb
desc = arcpy.Describe(gdb)

for child in desc.children:
   if child.dataType in ['Table','FeatureClass']:
       for field in child.fields:
           if field.domain:
               item = child.name
               try:
                   arcpy.RemoveDomainFromField_management(item, field.name)
               except arcpy.ExecuteError as e:
                   print("*** Remove Domain From Field *** arcpy.ExecuteError ***")
                   print(e.message)
                   print(traceback.format_exc())


domains = arcpy.da.ListDomains(gdb)
for domain in domains:
    arcpy.DeleteDomain_management(gdb, domain.name)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.