ArcSDE Administration Command Reference


This command converts an ESRI shapefile to an ArcSDE feature class (layer). It will convert both the attributes and the geometry.


Usage syntax


shp2sde -o append  -l <table,column> [-V <version_name>]
          -f <shape_file> [-I] [-a {none | all | file=<file_name>}]
          [-r <reject_shpfile>] [-c <commit_interval>]
          [-i <service>] [-s <server_name>] [-D <database>]
          -u <DB_User_name> [-p <DB_User_password>] [-v]


shp2sde -o init -l <table,column> -f <shape_file> [-I] [-v]
         [-a {none | all | file=<file_name>}] [-r <reject_shpfile>]
         [-c <commit_interval>] [-i <service>] [-s <server_name>]
         [-D <database>] -u <DB_User_name> [-p <DB_User_password>]


shp2sde -o create -l <table,column> -f <shape_file> [-I]
          [Spatial_Index] [{-R <SRID> | [Spatial_Ref_Opts]}]
          [-S <layer_description_str>] [-v] [-L {ON | OFF}] [-P {32 | 64}]
          [-e <entity_mask>] [-k <config_keyword>] [-M <minimum_ID>]
          [-a {none | all | file=<file_name>}] [-r <reject_shpfile>]
          [-V <version_name>] [-C <row_id_column>[,{SDE | USER},<min_ID>]]
          [-c <commit_interval>] [-i <service>] [-s <server_name>]
          [-D <database>] -u <DB_User_name> [-p <DB_User_password>]



[Spatial_Ref_Opts] := [-x <xoffset,yoffset,xyscale>]
                               [-z <zoffset,zscale>] [-m <moffset,mscale>]
                               [-G {<projection_ID> | file=<proj_file_name>}]

[Spatial_Index] := [-g {<grid_sz0>[,<grid_sz1>[,<grid_sz2>]] |
                        GRID,<grid_sz0>[,<grid_sz1>[,<grid_sz2>]] |
                        DBTUNE |
                        NONE |
                        RTREE |
                        FIXED,<sdo_level> |


shp2sde -h

shape to ArcSDE feature (entity) mapping table


ArcSDE feature (entity)




multipart points


1:n lines (spaghetti) or simple lines (line strings) Note: If the feature class (layer) allows both lines and simple line features, then all features that pass validation are stored as simple line features, while the rest are stored as lines. If the feature class (layer) supports only lines, then all features are stored as lines. If the feature class (layer) supports only simple line features, then all features not able to pass verification are discarded.


1:n area features







Adds features to an existing layer (the default)


Deletes all features of an existing layer before importing new features (not allowed on versioned data)


Creates a new layer and imports features from the shapefile into itan error is returned if the layer already exists





Attribute modes:



Does not load any attributes the default. The business table's layer is populated with the shape records, and the spatial column is populated with a sequential number. This option allows import of data created with the "-a none" option of the sde2shp command in versions 2.1 or 2.1.1.


Loads all attribute columns. If an attribute table doesn't exist for the layer, one is created. Otherwise, the incoming schema must be union compatible with the table if using the append or init option.


File containing lines of the form <shape_column [sde_column] The shape_column selects the column to be output, while sde_column specifies the column to load to.

"File containing lines of the form:
<shpCol> [sdeCol] [type] [size] [nDecs] [NOT_NULL]

The shpCol selects the column to be output; while the sdeCol is the new name of the column. The type specifies a legal type conversion. The size is the maximum size of the column and nDecs the number digits to the right of the decimal point for floating point data types. NOT NULL if specified requires that the column must have non NULL value.


Commit rate (default is the AUTOCOMMIT value from giomgr.defs)


Rowid's column_name, column_type and minimum_id


Database or data source name (not supported by all DBMSs)


Entity types allowed (npsla3+M)

n Nil
p Point shapes
s Line (spaghetti) shapes
l Simple line (line string) shapes
a Area shapes
3 Three-dimensional shapes can be added to the entity type mask with the "-o add" operation only.
+ Multipart shapes
M Measures on coordinates. The [-m] option is required if measures on coordinates is a defined shape type.


Path to and name of the shapefile


Spatial index type and parameters

<grid1,grid2,grid3> or

Create multi-level grid index.
grid2, grid3 are optional.


Use DBTUNE parameters to index.


No spatial index is created.


Create Rtree index.


Create fixed Quadtree index.


Create hybrid Quadtree index.



Coordinate system specifier. <projection_id>coordinate system ID (see the pedef.h file for the integer codes) file=<proj_file_name>file containing coordinate system description string


Prints usage and options


ArcSDE service name


Disable buffered inserts (default: ON)


Configuration keyword. Used with the create operation only. If not specified, the default "DEFAULTS" value from the dbtune table is used.


Map layer table and spatial column to load. They must exist, and the user must either own the table or have INSERT access to it. If you do not own the table, qualify the table name as "owner.table".


Enables or disables autolocking. Set to ON, autolocking is enabled; set to OFF autolocking is disabled. When autolocking is enabled, the session attempts to lock the area defined by a feature envelope before the feature can be edited. If the area is already locked, an error is returned. By default autolocking is enabled.


Measure offset and scale, separated by a comma. If the -m is not specified the measure offset is calculated from the shape files minimum measure value and the measure scale is calculated from the shape files measure delta. If these values cannot be obtained, the measure offset and scale is set to 0.0 and 1.0.


Minimum ID. New shape IDs are assigned the larger of the minimum ID or the maximum assigned ID + one (default: 1)




ArcSDE user DBMS password


The internal storage of the feature geometry, either 32-bit or 64-bit. Defaults to 32-bit.


Rejects shapefile name for rejected shapes. Shapes are only written to the rejects file if they can be. If the originating shape file was not created according to the ESRI shapefile specification, then it may not be possible to write a rejected shape record to the rejects shapefile. For instance, if the shape file contains a numeric field that exceeds a width of 19, the rejects shape file cannot be created.


Spatial reference ID (SRID)


ArcSDE server hostname (default: localhost)


Map layer description string


ArcSDE user DBMS username


Verbose optionreports records committed at the commit interval


ArcSDE version name. Version names are case-sensitive. For example, SDE.DEFAULT and SDE.default are different versions.


The x offset, y offset, and x,y scale values. If the -x option is not specified the x and y offset is calculated from the minimum x and y coordinate values of the shape file and the x,y scale is calculated from the maximum x or y delta value. If the x and y delta values cannot be obtained from the shape file the default is 0.0,0.0,1000.


The z offset and scale values separated by a comma. If the -z option is not specified the zoffset is calculated as the shape files minimum z value and the zscale is calculated from the shape files z delta. If the values cannot be obtained from the shape file the default is 0.0, 1.0.


Prints usage and options



If a grid is required, but not specified it is calculated with the following algorithm.

Only the first grid level is calculated. The second and third grid levels are set to 0.


Minimum grid size = 256
default number of grids = 64

Delta X = shape file extent maximum X – shape file extent minimum X
Delta Y = shape file extent maximum Y – shape file extent minimum Y
Maximum Delta = Larger of Delta X and Delta Y
grid level 1 = Maximum Delta / default number of grids
if ( grid level 1 * system units ) < Minimum grid size)
grid level 1 = minimum grid size / XY scale


The shp2sde command can convert up to 15 digits of precision or the maximum precision imposed by the SE_DOUBLE data type.


The shp2sde command converts shapefiles into ArcSDE feature classes (layers). This example converts a shapefile called census_data in geographic coordinates to a feature class (layer) called blocks.


$ shp2sde -o create -l blocks,shape -f census_data -a all -x -200,-100,100000 -g 1,4,16 -G 4269
-e a -k block_attr -u av


This example converts the "world" shapefile into a feature class (layer) called "borders". The data is small scale, so the scale (in the "-x" option) is set to 10,000. The example also uses the "-r "option to write any rejected shapes to a new shapefile called rejects.


$ shp2sde -o create -l borders,feature -f world -g 20,0,0 -x -180,-90,10000 -e a -k WORLD -a all -r rejects -s stout -u world


The row ID column of a an ArcSDE business table must be a unique integer column. The row ID column is always required if the feature class is stored in a DB2 or Informix DBMS or if the feature class contains an Oracle Spatial SDO_GEOMETRY column. Feature classes stored in the SQL Server DBMS and the Oracle DBMS (except those that have a SDO_GEOMETRY column) are not required to have a row ID defined unless they are registered with the ArcInfo Geodatabase or they are to be registered as multi-versioned.


For those feature classes required to have a row ID defined, by default shp2sde creates an SDE maintained unique integer column called objectid with and initial value set to 1. The -C option allows you to control the name, type and initial value of the row id column.


If the -C option is specified, the column name can be any name that follows the DBMS naming convention. The name defaults to objectid. The type can be either SDE maintained where ArcSDE controls the sequence of values entered into the column (ArcGIS requires any table registered with the geodatabase be registered with an SDE maintained row ID), and USER maintained where your application controls sequence of values entered into the row ID. The type defaults to SDE maintained. The initial value of the row ID can be a positive integer. The initial value defaults to 1.


The -C option is useful if the coverage attribute table contains a unique integer column that can serve as the row ID of the feature class you intend to convert the coverage to. Keep in mind that if the feature class is registered with the geodatabase, ArcSDE maintains further entry of values into the row ID column.


The following is an example of a the row id column being created with the -C option. The row ID column is called wid, it is SDE maintained and its initial value is set at 1. If the -C option is not specified in a situation in which the row ID column is required, the row ID column would be named objectid, it would be SDE maintained and its initial value would be set to 1.


$ shp2sde -o create -l borders,feature -f world -C wid,SDE,1 -e -u world


The shp2sde commands reports the status of the shape file to feature class transfer in the form of 'features converted' and 'features stored'. The meaning of these statistics is as follows:


features converted: The number of shape file records processed and converted partially or whole into an ArcSDE feature class.


features stored: The number of features actually stored in the ArcSDE feature class.

The two values can differ if multi-part shape file shapes are separated and stored as several ArcSDE features. This occurs if the feature class entity type does not allow multi-part features. To allow multi-part features to be stored in the feature class change the feature class entity type with either the sdelayer command or by adjusting the properties of the feature class with the ArcCatalog application.