9/23/2015 - 8:46 PM

ArcSDE Tools 10.2.2 Register Object with Geodatabase Example

ArcSDE Tools 10.2.2 Register Object with Geodatabase Example

The following is the correct syntax to use to register an object with a geodatabase using ArcGIS Server 10.2.2 Command Line Tools.
These tools were removed from esri's release of ArcGIS Server 10.3 and it was confirmed by esri that the arcpy, Python equivalent does not work and was logged as a bug [September 2015]. It is unlikely they will resolve it as they are looking forward to ArcGIS Pro. esri also officially announced that the 10.2.2 Command Line Tools would be forward compatabile until other options came to the fore.

Why would you want to use these archaic tools when it is easy to right-click on a feature and go to Manage > Register with Geodatabase? The purpose is for scripting, such as that done with Python, for Jenkins, etc. It should be noted as a limitation of SDE, that these commands will not be able to make a connection to the database and will not work unless the user that is used for connecting is made with both dbowner privileges and sysadmin role [this causes obvious security concerns, so tread cautiously]. This user login also cannot be a Windows Authenticated login and must be done as a database login.

Also note that the schema name of the object must be provided and that the -t must be GEOMETRY and not ST_GEOMETRY, for SQL Server spatial data type, like it says in the documentation.

Another note, the 10.2.2 Command Line tools do install documentation, and while limited and sometimes incorrect, it does provide some guidance. These can be found in your programs under ArcGIS > ArcSDE > Command References.

sdelayer -o register -u $Username -p $Password -t GEOMETRY -l dbo.Polygon_Layer_Name,SHAPE -i sde:sqlserver:$sqlServerInstance -D $DatabaseName -s $ServerName -e a -C ObjectId,SDE

sdelayer -o register -u $Username -p $Password -t GEOMETRY -l dbo.Point_Layer_Name,SHAPE -i sde:sqlserver:$sqlServerInstance -D $DatabaseName -s $ServerName -e p -C ObjectId,SDE

sdelayer -o register -u $Username -p $Password -t GEOMETRY -l dbo.Line_Layer_Name,SHAPE -i sde:sqlserver:$sqlServerInstance -D $DatabaseName -s $ServerName -e l -C ObjectId,SDE

Often times before you register an object, you need to delete it using SDE, then generate the table through SQL, then register the object again through SDE. The following is the syntax to delete an object:

sdetable -o delete -u $Username -p $Password -i sde:sqlserver:$sqlServerInstance -s $ServerName -D $DatabaseName -t $TableName -N

Also, if you're scripting this (e.g. from Jenkins), then you will likely need to add a system environment PATH to access these commands: C:\Program Files\ArcGIS\ArcSDE\commands\bin