Completely removing SDE layers via the command line

1188
1
Jump to solution
01-08-2013 09:54 AM
TimPuzycki
New Contributor
We have a process in place that reads data from an Oracle spatial database and creates layers in an SDE Geodatabase. Specifically we do this through Safe Software's Feature Manipulation Engine (FME).

The database is quite large and we refresh it every 6 months with a new version. What we want to do at this time is remove the oldest version to free up disk space.

We could use Oracle to drop the schema, but that of course will leave a lot of the layer metadata in the SDE tables, which we want to get rid of as well.

We are aware that we can go into ArcCatalog and remove the layers, but that is not a valid approach for us. We have strict change management and software release procedures and those in charge of executing the changes are not necessarily proficient in ArcGIS. Not only that, but since we're talking about 100+ layers we would strongly prefer to automate this process via some sort of script or batch file that can be invoked without any knowledge of ArcGIS.

So, we figured we could use the sdelayer and sdetable commands. Everything seemed to work fine when I executed the sdetable -o delete command. However, when I tried to recreate the layer in FME, I got the following error message: "ERROR |An error occurred while attempting to create the feature class '<schema name>.<table name>'. The error number from ArcObjects is: '-2147211774'. The error message from ArcObjects is: {Item with the same path name already exists.}" My research showed me that data still existed in the SDE.GDB_ITEMS table after I ran the sdetable -o delete command.

However, when I remove the layer manually from ArcCatalog it properly deletes the record from the SDE.GDB_ITEMS table.

So my question is, is there a simple way to completely and safely remove all of the underlying layer metadata from the command line or via some sort of arcObjects procedure, that does not involve manual removal of the layer via ArcCatalog?

Thanks!
0 Kudos
1 Solution

Accepted Solutions
VinceAngelo
Esri Esteemed Contributor
ArcSDE is unaware of geodatabase metadata.  The only safe way to manage removal
of tables registered with the geodatabase is by using ArcObjects.

Fortunately, the ArcPy Python library *is* geodatabase aware (based on ArcObjects),
so you can still script feature class removal without using GUI Desktop tools.

- V

View solution in original post

0 Kudos
1 Reply
VinceAngelo
Esri Esteemed Contributor
ArcSDE is unaware of geodatabase metadata.  The only safe way to manage removal
of tables registered with the geodatabase is by using ArcObjects.

Fortunately, the ArcPy Python library *is* geodatabase aware (based on ArcObjects),
so you can still script feature class removal without using GUI Desktop tools.

- V
0 Kudos