sdeimport

The sdeimport command imports data from an ArcSDE export file.

Usage syntax

sdeimport -o append {-l <table,column> | -t <table>} [-V <version_name>]
-f <{export_file | -}> [-q] [-v] [-c <commit_interval>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-p <DB_user_password>]
 

sdeimport -o create {-l <table,column> | -t <table>} [-V <version_name>]
-f <{export_file | -}> [-v] [-L <ON | OFF> ] [-P <HIGH | BASIC>]
[Spatial_Index] [-M <minimum_ID>] [-k <config_keyword>]
[-A {SDEX_CPG_OEM | SDEX_CPG_ANSI}] [-c <t;t;commit_interval>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-p <DB_user_password>] [-q]
 

sdeimport -o delete {-l <table,column> | -t <table>} -K <key_columns>
[-V <version_name>] -f <{export_file | -}> [-q] [-v] [-c <commit_interval>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-p <DB_user_password>]
 

sdeimport -o init {-l <table,column> | -t <table>} -f <{export_file | -}>
[-v] [-c <commit_interval>] [-i <service> | <port#> | <direct connection>]
[-s <server_name>] [-D <database_name>] -u <DB_user_name> [-p <DB_user_password>]
 

sdeimport -o update {-l <table,column> | -t <table>} -K <key_columns>
[-V <version_name>] -f <{export_file | -}> [-v] [-c <commit_interval>]
[-i {<service> | <port#> | <direct connection>}] [-q] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-p <DB_user_password>]
 

sdeimport -o update_else_insert {-l <table,column> | -t <table>}
-K <key_columns> [-V <version_name>] -f <{export_file | -}> [-q] [-v]
[-c <commit_interval>] [-i {<service> | <port#> | <direct connection>}]
[-s <server_name>] [-D <database_name>] -u <DB_user_name>
[-p <DB_user_password>]

Where

[Spatial_Index] := [-g [Grid_Options] | GRID,[Grid_Options] | AUTOMATIC | NONE | RTREE ]

[Grid_Options] : = [<grid_sz0>[,<grid_sz1>[,<grid_sz2>]] [,][{FULL | SPARSE}]
 

sdeimport -h

sdeimport -?
 

Operations

Operation Description Example
append Imports and appends records into an existing table, feature class, or raster layer (default) Add records to an existing table, feature class, or raster layer
create Creates a new table, feature class, or raster layer based on the definition stored in the export file and imports records into it; an error is returned if the dataset already exists. Create a table, feature class, or raster layer
delete Deletes the records from the target table, feature class, or raster layer that match the key column values of the export file Delete records
init Deletes all features of an existing table, feature class, or raster layer before importing new records Delete then reinsert records
update Updates the records in the target table, feature class, or raster layer that match the key column values of the export file Update records
update_else_insert Updates the existing records of the target table, feature class, or raster layer that match the key column values of the export file and inserts into the target the records of the export file whose key values do not match Update existing records and insert nonmatching records

 

Options

Options Description
-A (Windows only) By default, if you generate an ArcSDE export file from an ArcSDE 9.1 or lower geodatabase environment on a Windows computer and the national language support (NLS) environment variable is set, the export file's string data is in OEM codepage. If the NLS variable is not set, the export file's string data is in ANSI codepage. If you generate an ArcSDE export file from an ArcSDE 9.1 or lower geodatabase environment on a UNIX machine, the export file's string data will be in ISO code page.

The -A option allows Windows users to execute the sdeimport command with added code page control. A visual inspection of the loaded attribute data is the only way to ensure data integrity.

If the export file was created in an ArcSDE 9.2 or greater release geodatabase and you are importing to an ArcSDE 9.2 or greater geodatabase, you do not need to specify this option because the string data in the export file from these releases uses Unicode encoding.

Note: It is possible to create an export file for use in an ArcSDE 9.1 or lower client environment from an ArcSDE 9.2 or greater ArcSDE
geodatabase by specifying the [-r <target_ArcSDE_version_number>] option when creating the file with sdeexport. If you do this, the codepage will follow the same rules as listed in the first paragraph:

Windows with NLS set = OEM
Windows without NLS set = ANSI
UNIX = ISO

-c Commit rate (default = the AUTOCOMMIT parameter value in the SERVER_CONFIG or sde_server_config table)
-D Database or data source name (not supported on Oracle databases)
-f Export format file name; if set to -, import is from standard input
-g Spatial index type and parameters
 
GRID,<grid_sz1>[,<grid_sz2>[,<grid_sz3>]] ,[FULL|SPARSE] Creates multilevel grid index
(Grid2 and grid3 are optional and are not used with Oracle Spatial, Informix, PostgreSQL, or SQL Server spatial types.)

If you don't enter grid values, it is the same as specifying an AUTOMATIC spatial index type.

FULL grids create a spatial index grid on the entire feature envelope. This is the default option if GRID is specified and is the type of grid always created in ArcSDE 9.1 and lower.

SPARSE grids create spatial index grids only where grids actually include parts of the feature.

See the Discussion section for more details.

AUTOMATIC For Oracle Spatial, Informix, and PostgreSQL, this is RTREE.

For all other storage types, if the layer is in normal IO mode and there are 0 features, the grid type is NONE. If one or more features is present and the layer is in normal IO mode, grid sizes will be calculated and set based on the calculations below. If the layer is in load_only IO mode, grid sizes will be calculated and set based on the calculations below when the layer is returned to normal IO mode.

If there are no valid envelopes detected, grid sizes are calculated as:

grid_size1 = 1000000.0 / layerGrid->xyUnits
grid_size2 = 1000000000.0 / layerGrid->xyUnits

If it is a point layer, grid sizes are calculated as:

grid_size1 = 1000.0 / layerGrid->xyUnits

NONE No spatial index is created
RTREE Creates Rtree spatial index (Informix, Oracle Spatial, PostgreSQL)
-h or -? Use either of these options to see the usage and options for the command. Note: If using a C shell, use -h or "-\?".
-i ArcSDE service name, port number, or direct connection information (default: esri_sde or 5151)
-k Configuration keyword present in DBTUNE table (default: DEFAULTS); used with the create operation only.
-K The list of columns used as a key to locate matching records for the delete, update, or update_else_insert operations
-l Either the feature class business table and spatial column or raster layer's business table and raster column

If you are not the owner of the table, you must qualify the table name as owner.table and have the necessary privileges for that table.

-L Turns on or off autolocking (default: ON)
-M Minimum feature ID

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

-o Operation
-p DBMS user password
-P Layer coordinate precision: BASIC (32-bit) or HIGH (64-bit)

If the -P option isn't specified, sdeimport loads data in the precision specified by the SERVER_CONFIG DEFAULTPRECISION setting. The default setting of DEFAULTPRECISION is 64 (HIGH).

If you attempt to place high precision data in a basic precision, you will receive the following warning message:

WARNING:
Loading high precision data into a low precision layer.
Might encounter invalid coordinate range error.

BASIC precision is not supported for geodatabases in PostgreSQL.
-s ArcSDE server host name (default: localhost)
-t Business table name
-u DBMS user name
-v Verbose optionreports records committed
-V Version name (default: sde.DEFAULT)

Inserts the data into the version specified or, if not specified, inserts the data into the default version. Not allowed for the init operation.

Version names are case sensitive. For example, SDE.DEFAULT is a different version from SDE.default.

 

Discussion

ArcSDE export files created by the sdeexport command are imported using the sdeimport command. The sdeexport command can create exports of records from a table, feature class, or raster layer. If you are importing data from a later release of ArcSDE, you would have needed to specify a version using the -r option for the export file when you created it. For example, if you want to export data from ArcSDE 9.0 and then import it to an ArcSDE 8.3 geodatabase, you must specify -r 8.3 when you run sdeexport. The format version as well as other metadata is stored in the header of the export file.

Note: If the 3.0.1 format was specified when the export file was created, only the records of the feature class can be exported.

The create operation allows you to create a new table, feature class, or raster layer. When you use the create operation, if the object specified by the -t option already exists, the sdeimport command returns an error. A configuration keyword can be specified with the -k option, allowing you to control the storage within the DBMS. If the -k option is not specified, the DEFAULTS keyword is used.

The sdeimport command depends on the type of records the export file contains to create the appropriate object. If the export file contains feature class records and the -t option is specified to create a table from the export file, a feature class will be imported. If the -l option is specified to create a feature class or raster layer from an export file that contains table records, the sdeimport command will return an error.

If the -l option is specified with any operation other than create, the spatial reference stored in the export files header must match the spatial reference of either the feature class or the raster layer.

Beginning with ArcGIS Server 9.2 geodatabases, you have the option to create sparse spatial index grids. Sparse grids populate the spatial index with information for only those grids that actually contain a portion of a feature. For example, if you created a spatial index on a river feature class, only those grids that the river crossed would be indexed for the river.

This could be more efficient for spatial queries, because grids that do not qualify as crossing the feature (in this case, rivers) will be eliminated from the query results during the primary filter process ArcSDE performs when executing spatial queries. Be aware that if you use third-party applications to perform envelope-on-envelope spatial queries, using a sparse index grid will affect query results.

If instead you used a full grid for the rivers, the nonqualifying grids would still be eliminated, but they wouldn't be eliminated until the secondary filter process.

 

Examples

Add records to an existing table, feature class, or raster layer

The append operation allows you to add records to an existing table, feature class, or raster layer. If the target does not exist, sdeimport returns an error.

In this example, the append operation adds the records of the usa export file to the world feature class.

sdeimport -o append -l world,shape -f usa -u admin -p passwd 

Create a table, feature class, or raster layer

The create operation creates a new table, feature class, or raster layer based on the definition stored in the export file then imports records into it from the source file. If a layer or table of the same name already exists, an error is returned.

In this example, the sdeimport command creates the table customer_names in the DBMS from the table description stored in the header of the custname export file. The records of the custname export file are loaded into the customer_names table.

sdeimport -o create -t customer_names -f custname -k smalltab -g GRID,FULL -u admin -p passwd

The following example shows an import of an export set created in volumes:

sdeimport -o create -t countries.000 -f countries -g GRID,FULL -u admin -p passwd

The example below shows the creation of a HIGH precision layer with a sparse index grid:

sdeimport -o create -t rivers -f rivers -g GRID,SPARSE -P HIGH -u loader -p down

This example shows what happens when you create a BASIC precision layer with a HIGH precision source file:

% sdeimport -o create -t markets_low -f compete.sdx -P BASIC -v -u editor -p changes

SDEX File Import Administration Utility
-----------------------------------------------------
Importing SDEX from compete.sdx ...
Importing spatial column "SHAPE"
WARNING:
Loading high precision data into a low precision layer.
Might encounter invalid coordinate range error.

6 records processed
6 records read.
6 records stored.

Note that to receive this warning, you need to have specified the verbose (-v) option, as shown above.

Delete records

The delete operation allows you to remove records from an existing target. The records of the target whose key column values match those of the export file are deleted. The key columns are specified by the -K option. The key columns must exist in both the export file and the target; otherwise, an error is returned.

In this example, the delete operation removes those records from the usa feature class that have fips column values matching those of the california export file.

sdeimport -o delete -l usa,shape -f california -K fips -u admin -p passwd

Delete then reinsert records

The init operation allows you to delete the existing records of the target before inserting the records. If the target does not exist, an error is returned. The target business table definition must match the definition of the exported records.

In this example, the init operation deletes the records of the montana raster layer and inserts the records from the montana export file.

sdeimport -o init -l montana,image -f montana -u admin -p passwd

Update records

The update operation allows you to update the records of the target. The target records possessing key column values that match those of the export file are updated with the records stored in the export file.

In this example, the update operation replaces the records of the usa feature class with the records from the export file that match the fips key column value.

sdeimport -o update -l usa,shape -f nebraska -K fips -u admin -p passwd

Update existing records and insert nonmatching records

The update_else_insert operation allows you to either update or insert the records of the target. If the target key columns match the values of the sdeexport files, the records are updated. For those records of the export file for which a match is not found, the records are inserted into the target.

In this example, the update_else_insert operation replaces the records of the usa feature class with the records of the texas export file, which has matching fips key column values. Those records of the texas export file that do not match on the fips key column are inserted in the usa feature class.

sdeimport -o update_else_insert -l usa,shape -f texas -K fips -u admin -p passwd

 

Home

Copyright © Environmental Systems Research Institute, Inc. 2004 - 2010.