Add Change Domain Owner Tool

1804
4
05-25-2012 05:24 PM
Status: Open
Esri Regular Contributor
 In our environment, we want all coded domains to be owned by a specific user. If a coded domain gets created by another user (for example, dragging in a feature class from another geodatabase), there is no way to change the owner, short of removing the domain from any field that references it, exporting the domain to a table, deleting it, re-creating it from the table, and then reassigning it to any feature class that makes use it it. In ArcSDE 9.3.1 (at least, in Oracle), it was a trivial matter to open the geodastabase and, using SQL Plus, simply change the owner of the domain.
4 Comments
To implement this looks like first we need an ArcObjects enhancement. Please add AlterDomainOwner method to IWorkspaceDomains4 if the existing implementation of AlterDomain can not be changed,
as the current documentation says: user may create a new instance of a domain with the same name, owner, and field type as an existing domain.

A tool for changing domain owners is still needed as much now, if not more then when this idea was created!

I found a way to do this in Microsoft SQL Server using an SET statement with a modify function.  In the example below, I change the domain owner of the 'DATA QUALITY CODE_3' to the user 'SDE', but it could be set to any user account regardless of the owner.  I was able to figure this out using ESRI's tech article "How To: Return information on coded value domains using ArcSDE 10.x for SQL Server."

UPDATE [GeoLib].[sde].[GDB_ITEMS]
SET [Definition].modify('
replace value of
(/GPCodedValueDomain2/Owner/text())[1]
with ("SDE")'
)
WHERE TYPE in ('8C368B12-A12E-4C7E-9638-C9C64E69E98F','C29DA988-8C3E-45F7-8B5C-18E51EE7BEB4')
  AND PhysicalName = 'DATA QUALITY CODE_3'
go‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

In Line 6, is the GUID in your script a constant to all geodatabases?  and does this actually reset the owner or just the name or some kind of alias?  background is...I imported a dataset from another database with the GDB owner of DBO via XML and the target geodatabase does not have dbo as a user, the data owner is SDEADMIN, GDB owner is SDE.