The sdelayer command creates and administers ArcSDE layers.
Note: ArcSDE commands do not interact with the geodatabase system tables. Therefore, if your layer is registered with the geodatabase and participates in geodatabase functionality, such as networks or topology, do not use the sdelayer command to administer the feature class. Instead, use the ArcGIS tools and wizards.
sdelayer -o add -l <table,column> -e <entity_mask>
[-t <storage_type>]
[Spatial_Index][{-R <SRID> | [Spatial_Ref_Opts]}]
[-M <minimum_id>] [{-f <init_features,avg_points> | -k <config_keyword>}]
[-E <{empty | xmin,ymin,xmax,ymax}>] [-L {ON | OFF}]
[-C <row_id_column>[,{SDE|USER}[,<min_ID>]]]
[-P {HIGH | BASIC}]
[-S <layer_description_str>]
[-i {<service> | <port#> | <direct connection>}]
[-s <server_name>] [-D <database_name>]
-u <DB_user_name>
-p <DB_user_password> [-q]
sdelayer -o alter -l <table,column> [-e <entity_mask>] [-M <minimum_id>]
[-S <layer_description_str>]
[-k <config_keyword>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] [Spatial_Index] [-L <ON | OFF>]
[-E <{empty | calc | xmin,ymin,xmax,ymax}>]
[-G {<projection_ID> | file=<proj_file_name}>]
[-P HIGH[{-R
-u <DB_user_name> [-p <DB_user_password>] [-N] [-q]
sdelayer -o delete -l <table,column>
[-s <server_name>]
[-i {<service> | <port#> | <direct connection>}] [-D <database_name>]
-u <DB_user_name> [-p <DB_user_password>] [-N] [-q]
sdelayer -o {describe | describe_long} [{-O <owner | -l <table,column>}]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>]
-u <DB_user_name> [-p <DB_user_password>] [-q]
sdelayer -o feature_info -l <table,column> [-V <version>]
[-r {valid | all | invalid}] [-w <"where_clause">] [-c]
[-C <row_id_column>] [-T <output_table_name>] [-k <config_keyword>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>]
[-u <DB_user_name>] [-p <DB_user_password>]
[-N] [-q]
sdelayer -o {grant | revoke} -l <table,column> -U <user>
-A <SELECT,UPDATE,INSERT,DELETE>
[-s <server_name>]
[-i {<service> | <port#> | <direct connection>}]
[-D <database_name>] -u <DB_user_name>
[-p <DB_user_password>] [-I] [-q]
sdelayer -o list -l <table,column> -v <shape_id>
[-i {<service> | <port#> | <direct connection>}]
[-s <server_name>] [-D <database_name>]
-u <DB_user_name> [-p <DB_user_password>] [-q]
sdelayer -o {load_only_io | normal_io} -l <table,column>
[-i {<service> | <port#> | <direct connection>}]
[-s <server_name>]
[-D <database_name>]
-u <DB_user_name> [-p <DB_user_password>] [-q]
sdelayer -o
migrate -l <table,column> -k <config_keyword>
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
-u <DB_user_name> [-p <DB_user_password>] [-N] [-q]
sdelayer -o register -l <table,column> -e <entity_mask> -t <storage_type>
{[-C <row_id_column>[,{SDE|USER}[,<min_ID>]]]}
[Spatial_Index]
[-E <{empty | xmin,ymin,xmax,ymax}>] [{-R <SRID> | [Spatial_Ref_Opts]}]
[-S <layer_description_str>] [-k <config_keyword>]
[-i {<service> | <port#> | <direct connection>}] [-s <server_name>]
[-D <database_name>] -u <DB_user_name> [-p <DB_user_password>] [-q]
sdelayer -o {stats | si_stats} -l <table,column>
[-i {<service> | <port#> | <direct connection>}]
[-s <server_name>]
[-D <database_name>]
-u <DB_user_name> -p <DB_user_password> [-q]
sdelayer -o truncate -l <table,column>
[-s <server_name>]
[-i {<service> | <port#> | <direct connection>}] [-D <database_name>]
-u < DB_user_name> [-p <DB_user_password>] [-N] [-q]
Where
[Spatial_Ref_Opts] := [-x <xoffset,yoffset,xyscale[,xyClusterTol]>]
[-z <zoffset,zscale[,zClusterTol]>] [-m <moffset,mscale[,mClusterTol]>]
[-G {<projection_ID> | file=<proj_file_name>}]
[Spatial_Index] := [-g [Grid_Options] |
GRID,[Grid_Options] | AUTOMATIC | NONE | RTREE ]
[Grid_Options] : = [<grid_sz0>[,<grid_sz1>[,<grid_sz2>
sdelayer -h
sdelayer -?
Operation | Description | Examples |
add | Adds a spatial column to a business table, creating a feature class | Create a new feature class from an existing table |
alter | Modifies characteristics of a feature class; can only be run by the owner of the feature class | Alter properties of the feature class |
delete | Deletes an entire
feature class The feature class definition is permanently removed, but the business table is not deleted. When using binary storage, all features are also deleted. |
Delete a feature class |
describe | Lists feature class
definitions (short form) If a feature class is not specified, lists all feature classes to which the user (specified with the -u option) has access. |
Describe a feature class |
describe_long |
Lists feature class
definitions (long form) If a feature class is not specified, lists all feature classes to which the user (specified with the -u option) has access. |
Describe a feature class |
feature_info | Reports information about the feature, such as shape validity; measurements and extent information; the feature ID (FID); the presence of annotation, whether the feature contains CAD data; the presence of inclusions or conjoined inner rings; the minimum precision of the layer; and the number of points, parts, and subparts contained in the feature | Obtain information about a feature's geometry |
grant | Grants a user access to a specified feature class | Grant and revoke access to a feature class |
list | Lists the fields of a feature including the point values for all points that define the shape of the feature | Get a list of a feature's fields |
load_only_io | Sets the input/output (I/O) mode of the feature class to load-only, dropping the spatial index, and allowing only store and replace I/O operations | Switch between load only and normal I/O mode |
migrate |
Migrates Oracle feature classes from
Also migrates SQL Server feature classes from
What storage type the data is migrated to depends on what the geometry storage value is for the DBTUNE configuration keyword specified with the -k option. |
Migrate a feature class to a new geometry storage |
normal_io | Sets the I/O mode of the feature class back to normal I/O mode | Switch between load only and normal I/O mode |
register | Registers with ArcSDE a
table having a spatial column defined using Oracle Spatial
Geometry Type, Informix Spatial DataBlade, DB2 Spatial Extender,
the spatial type for Oracle, the spatial type for PostgreSQL,
the PostGIS geometry type, or the SQL Server geometry or
geography type. Registering a spatial table with ArcSDE adds records for the business table to the TABLE_REGISTRY, COLUMN_REGISTRY, LAYERS, and GEOMETRY_COLUMNS system tables (SDE_TABLE_REGISTRY, SDE_COLUMN_REGISTRY, SDE_LAYERS, and SDE_GEOMETRY_COLUMNS in PostgreSQL and SQL Server). |
Register a table with a spatial column with ArcSDE |
revoke | Revokes access to a feature class from a user | Grant and revoke access to a feature class |
stats | Reports feature class statistics | Display feature class statistics |
si_stats | Reports spatial index statistics (only applies to binary geometry storage types in geodatabases in Oracle and SQL Server and the ST_Geometry storage type in Oracle) | Display feature class statistics |
truncate | Deletes all features in the feature class; the attributes remain but the spatial component is dropped. | Remove the spatial records from a feature class |
Use the add operation to create a new feature class by adding a spatial column to a table. This must be done by the owner of the table.
The following example takes a table named victoria in an Oracle database and adds to it an SDELOB (-k) geometry column named parcels. A grid index is defined (-g), as are x,y (-x) and z- (-z) offsets. Layer autolocking is off (-L); precision for the geometry storage will be high (-P); and the feature class will be able to store polygons, SDE annotation, z-coordinates, and multipart shapes (-e).
sdelayer -o add -l victoria,parcels -e aA3+ -g
GRID,1000 -x 0,0,200 -z 0,200 -P HIGH -L off
-k SDELOB -u av -p mo -i 1000
The x,y offsets and scale are optional. If unspecified, they default to 0.0, 0.0, 1.0.
Calculate the x-, y-, and z-scale values for the feature class by using the size of the service area and how much resolution is needed for the data. Coordinates are truncated if the scales are too small. For example, if the scale is set to 100 for coordinates in meters, the unit of resolution is centimeters. To set the unit of resolution to millimeters, increase the scale to 1,000.
The precision is also optional. If unspecified, it defaults to high precision.
In this example, an ST_Geometry spatial column (-t), coords, is added to a table, colpts, in a PostgreSQL database. The table will be able to store point and multipoint data (-e), and will use a spatial reference ID of 3 (-R). In this case, the data will also be stored in high precision, which is the default if -P is not specified. A direct connection to the database is used instead of an ArcSDE service (-i).
sdelayer -o add -l colpts,coords -e p+ -k DEFAULTS -t
ST_GEOMETRY -R 3 -i
sde:postgresql:megacomp
-D dbdev -u fxavier -p dontlook
Using the alter operation of sdelayer, you can modify the entity mask, spatial index grid cell sizes (if the geometry storage type uses grid indexes), coordinate system ID, description, envelope, or configuration keyword of feature classes that you own. The example below modifies the entity mask to store polygons, line strings, and multipart geometries (-e); uses a different configuration keyword for storage definition (-k); provides a coordinate system ID (-G); and adds a description of the victoria table (-S).
sdelayer -o alter -l victoria,parcels -e al+ -k vict2 -G 4326 -S "Victoria Parcels" -u av -p mo -i 1000
This example alters the precision of the blocks layer to high precision (-P); specifies the projection file to use for the defined projection (-G); and sets the x,y (-x), z- (-z), and m- (-m) offsets and scales to use.
sdelayer -o alter -l blocks,shape -P HIGH -x 1,1,1 -z 0,0 -m 0,0 -G file=c:\blocks.prj
This example changes the grid size on the victoria table's spatial index. The -N option suppresses the prompt to verify the change in grid size.
sdelayer -o alter -l victoria,parcels -g GRID,2000 -u av -p mo -i 1000 -N
The ArcSDE geodatabases for Informix and PostgreSQL use an R-tree index for the spatial index. Changing the grid parameters with the -g option has no effect on a feature class in an Informix or PostgreSQL database since it does not have a grid index. The R-tree index can be created and dropped but not altered. Changing the grid parameters with the -g option also has no effect on Oracle Spatial (SDO_Geometry) feature classes.
Deleting a feature class does not remove the object from the database; it only takes away the object's status as a feature class.
For feature classes that have been implemented using the binary schema (Oracle and SQL Server only), deleting a feature class drops the DBMS spatial tables (the F and S tables), makes the feature columns null, and removes the definition of the feature class from the ArcSDE system tables COLUMN_REGISTRY, GEOMETRY_COLUMNS, and LAYERS. Under the spatial data types and functions implementations, the feature class definition is removed from the ArcSDE system tables COLUMN_REGISTRY, GEOMETRY_COLUMNS, and LAYERS.
For all types of feature classes, the business table still exists in the database and is registered (a record still exists for it in the TABLE_REGISTRY table). To completely remove the business table, use sdetable -o delete.
Note: You should also use sdetable -o delete to delete views, not sdelayer -o delete.
Do not use sdelayer or sdetable -o delete on a feature class that has been
registered with the geodatabase. The sdelayer and sdetable commands do not
affect the geodatabase system tables. Therefore,
records would still exist for the feature class in the GDB_* system tables. To
delete these objects, you must use ArcGIS Desktop or another ArcObjects
client to remove a feature class if it has already been registered with the
geodatabase.
If a user has the feature class locked, sdelayer returns an
error. You can use the sdemon info operation to make sure the feature class is not locked. The sdemon kill operation can remove the process that
locked the feature class, provided the connection is through an ArcSDE
service. If using direct connections to the geodatabase, connections are removed
through the DBMS. These are abrupt solutions and should only
be used when necessary. If circumstances permit, you should inform all users
that the feature class is going to be removed and provide
application programmers with enough time to remove references to the feature
class from their programs. As implied in the previous paragraph, the sdelayer command is not geodatabase
aware; therefore, references to feature classes that participate in feature
datasets, networks, and topologies will not be removed. Such feature classes
should be removed using ArcCatalog.
Use the delete operation to
delete the victoria feature class. Only the owner of the feature class can
delete it.
sdelayer -o delete -l victoria,parcels -u av -p mo -i 1000
You can list a feature class definition by using the sdelayer command with the describe or describe_long operations. All fields that define a feature class are displayed on the screen. To list all available feature classes to which the current user (specified with the -u option) has access, don't specify a feature class name. In this example, all the feature classes in an Oracle database to which user av has access are described.
sdelayer -o describe -u av -p mo -i
1442
Layer Administration Utility
-----------------------------------------------------
Table Owner : AV
Table Name : BORDERS
Spatial Column : FEATURE
Layer id : 1
Entities : a
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : Enabled
Precision : Basic
User Privileges : SELECT, UPDATE, INSERT, DELETE
Layer Configuration : DEFAULTS
-----------------------------------------------------
Table Owner : GTHOR
Table Name : BOUNDARIES
Spatial Column : BOUNDARY
Layer id : 2
Entities : a
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE, INSERT
Layer Configuration : DEFAULTS
-----------------------------------------------------
Table Owner : JPISHA
Table Name : MINOR_ROADS
Spatial Column : ROAD_LAYER
Layer id : 3
Entities : s
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : Enabled
Precision : Basic
User Privileges : SELECT
Layer Configuration : DEFAULTS
-----------------------------------------------------
To display the definition for a particular feature class, specify the table and column name with the -l option. This example describes just the borders feature class.
sdelayer -o describe -l borders,feature -u av -p mo -s
fortune -D store -i sde:sqlserver:fortune
Layer Administration Utility
Table Owner : AV
Table Name : BORDERS
Spatial Column : FEATURE
Layer id : 1
Entities : a
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : Enabled
Precision : Basic
User Privileges : SELECT, UPDATE
Layer Configuration : DEFAULTS
To get a description of all the layers owned by a particular user, specify the -O option. In this example, the descriptions of all feature classes to which the user (specified with the -u option) has privileges in the PostgreSQL database will be returned. When prompted for the user password, type the password for the user specified by the -u option.
sdelayer -o describe -O editora -i 3500 -D myorg -u qauser
Enter Database User password:
Layer Administration Utility
Database : myorg
Table Owner : editora
Table Name : admin_areas
Spatial Column : shape
Layer id : 11
Entities : nac+
Layer Type : In-Line Spatial Type
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE, INSERT, DELETE
Layer Configuration : DEFAULTS
-----------------------------------------------------
Table Owner : editora
Table Name : soi
Spatial Column : shape
Layer id : 15
Entities : nac+
Layer Type : Extended SQL Type
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE
Layer Configuration : ST_GEOMETRY
-----------------------------------------------------
Table Owner : editora
Table Name : office_locs
Spatial Column : shape
Layer id : 43
Entities : npc
Layer Type : Extended SQL Type
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE, INSERT, DELETE
Layer Configuration : ST_GEOMETRY
Note: Specify the -O option or the -l option when describing feature classes, not both.
In the next example, a direct connection is being made to a named instance of SQL Server. The command is determining to which feature classes, owned by the database user sasha, the Windows authenticated user, maurice, has privileges.
sdelayer -o describe -O sasha -u "bigdomain\maurice" -p opensesame -i sde:sqlserver:bigbro\cerebrum -D neuron2
Layer Administration Utility
Database : NEURON2
Table Owner : SASHA
Table Name : GAS_LINES
Spatial Column : GEOM
Layer id : 24
Entities : nslc+
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : ENABLED
Precision : High
User Privileges : SELECT
Layer Configuration : DEFAULTS
This example describes all the feature classes in a SQL Server database that are owned by the dbo user.
sdelayer -o describe -O dbo -i 4321 -D neuron1
Database : NEURON1
Table Owner : DBO
Table Name : BASE
Spatial Column : SHAPE
Layer id : 1
Entities : a+
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE, INSERT, DELETE
Layer Configuration : DEFAULTS
-----------------------------------------------------
Database : NEURON1
Table Owner : DBO
Table Name : MARKERS
Spatial Column : SHAPE
Layer id : 2
Entities : pc
Layer Type : SDE
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE, INSERT, DELETE
Layer Configuration : DEFAULTS
The describe_long operation returns the same information as describe plus spatial information, such as the spatial reference ID (SRID), coordinate system, false x- and false y-offset, system units, z-offset and units, measure offset and units, spatial index information, and layer envelope. It also includes the minimum shape ID in the feature class and the date the feature class was created. An example of describe_long follows:
sdelayer -o describe_long -u ras -p berry -i 1200 -s joe -D
org_prod -l provinces,feature
Layer Administration Utility
Layer Description : <None>
Table Owner : ras
Table Name : provinces
Spatial Column : feature
Layer Id : 39
SRID : 6
Minimum shape Id : 1
Offset :
falsex: -116261899.997298
falsey: -97193799.991298
System Units : 1600.000000
Z Offset : 0.000000
Z Units : 1.000000
Measure Offset : <None>
Measure Units : <None>
XY Cluster Tolerance : 0.02
Spatial Index :
parameter: SPIDX_RTREE
exist: Yes
array form: -2,0,0
Layer Envelope :
minx: 13371955.24270, miny: 413328.09870
maxx: 13374287.69270, maxy: 415795.05870
Entities : nac+
Layer Type : Extended SQL Type
Creation Date : 11/01/07 15:17:07
I/O Mode : NORMAL
Autolocking : Enabled
Precision : High
User Privileges : SELECT, UPDATE, INSERT, DELETE
Coordinate system : PROJCS["NAD_1983_StatePlane_Michigan_South_FIPS_2113",GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT
["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",4000000.0],
PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-84.36666666666666],
PARAMETER["Standard_Parallel_1",42.1],PARAMETER["Standard_Parallel_2",43.66666666666666],
PARAMETER["Latitude_Of_Origin",41.5],UNIT["Foot",0.3048]]
Layer Configuration : DEFAULTS
The spatial index information includes whether a spatial index exists (exist), if so, the type of spatial index it is (parameter), and what the grid size or index flag is (array form). Grid sizes are only used for spatial grid indexes, which are present on feature classes using SDEBINARY, SDELOB, and ST_Geometry in DB2 and Oracle. For all other spatial types, an index flag is passed. In the previous example, the spatial index exists, it is an R-tree index, and the flag for an R-tree index is -2,0,0. Other index flags include -6,0,0 for SQL Server modified b-tree spatial indexes and -1,0,0 to specify no spatial index, and 0,0,0 (the default if nothing is specified when the layer is created) indicates ArcSDE will use an "automatic" spatial index. This value varies depending on the type of DBMS. See the description of the AUTOMATIC value on the -g option in the options table for descriptions.
An example of the parameter and array form values for a feature class that does have a spatial grid index are as follows:
parameter: SPIDX_GRID,GRID0=580,FULL
array form: 580,0,0
This spatial index has one grid of size 580 and is using a full (as opposed to a sparse) grid.
You can get information about the geometry of a feature by using the feature_info operation. This is useful when working with an Oracle Spatial database.
The feature_info option of the sdelayer command returns up to 21 different characteristics of a feature, in a series of comma-delimited fields. Fields are returned in the following order:
If the table does not have a user or row ID column maintained by ArcSDE, the Feature ID column value is returned here instead. If it has neither row ID nor FID, the value returned is 0.
If there is no FID, then the row ID is returned instead. If there is neither row ID nor FID, 0 is returned.
Values are either T (true) or F (false).
Returned values are either T (true) or F (false).
If an error is encountered when attempting to obtain the parts, an error code from the sdeerno.h file is supplied instead.
If this is a type of shape that does not have subparts, the value is 0. If instead an error is encountered when attempting to obtain the subparts, an error code from sdeerno.h is supplied.
"T" is always returned for area shapes.
This field is only present if this layer has z-coordinates.
This field is only present if this feature class has z-coordinates.
This field is only present if this feature class has measures.
Note: Values for 12 through 21 are only returned if the –c argument is specified.
The following example gets the feature geometry information for a feature class called lakes on a server called myrtle. The -r option is specified with "all", so all shapes will be read for validity. (The list returned in the example below is only a partial list of the results.)
sdelayer -o feature_info -l world.lakes,feature -r all -i sde_world
-s myrtle -u him -p shade
Layer
Administration Utility
Row Id, FID, Entity Type, Annotation, Cad Data, Number of Points, Number of
Parts, Number of Subparts, Self-Touching Rings, Minimum Precision,
Verification
0,1,A,F,F,38,1,1,F,Basic,0
0,2,A,F,F,29,1,1,F,Basic,0
You also have the ability to output the feature errors to a table in the database using the -T and -C options. In the following example, feature information is being returned for all features in the feature class corridor. Geometry errors and the feature IDs (stored in the OBJECTID field) will be output to a table, cor_bad_ftrs, using the storage parameters specified by the TEMP configuration keyword. You might create a custom keyword to specify, for example, a different tablespace for the storage of the table.
sdelayer -o feature_info -l corridor,shape -r all -T
cor_bad_ftrs -k TEMP -C OBJECTID
Layer Administration Utility
Row Id,FID,Entity Type,Annotation,Cad Data,Number of Points,Number of Parts,
Number of Subparts,Self-Touching Rings,Minimum Precision,Verification
1,1,A,F,F,5,1,1,F,Basic,0
2,2,A,F,F,5,1,1,F,Basic,-152
3,3,A,F,F,4,0,0,F,Basic,-150
4,4,A,F,F,5,1,1,F,Basic,0
5,5,A,F,F,5,1,1,F,Basic,0
Total rows examined: 5
Total invalid shapes: 2
OBJECTID and reasons that features failed are in table cor_bad_ftrs
You can then query the table to get information on the features that have invalid geometries.
SELECT * FROM cor_bad_ftrs;
OBJECTID REASON
2 POLYGON SHELL HAS NO AREA
3 POLYGON DOES NOT CLOSE PROPERLY
The grant and revoke operations control access to feature classes. The grant operation allows the owner of a feature class to provide either SELECT, INSERT, UPDATE, or DELETE privileges to other users or roles. The revoke operation allows the owner to rescind previously granted privileges.
The following two commands grant and then revoke select privileges from user bob:
sdelayer -o grant -l
victoria,parcels -U bob -A SELECT -u av -p mo -s ion -i 1000
sdelayer -o revoke -l victoria,parcels -U bob -A SELECT -u av -p mo
-s ion -i 1000
Granting privileges to roles is easier to maintain than repetitively granting the privileges to each user. Whenever possible, create roles representing privileges that can be granted to a group of users. Then specify the role name with the -U option. In this example, editing privileges are granted to the database role editors.
sdelayer -o grant -l victoria,parcels -U editors -A SELECT,UPDATE,INSERT,DELETE -u av -p mo -i esri_8022
If you need to grant privileges to an operating system (OS) user, the syntax is different. The following example shows granting SELECT privileges to a Windows user, , in a SQL Server database to which a direct connection is being made:
sdelayer -o grant -l borders,line -U -A SELECT -u -p -d -i sde:sqlserver:myserver\ssinstance
This example shows revoking SELECT privileges on a layer, buildings, from an OS user (OPS$GANESH) in Oracle. The owner is also an OS user and, therefore, the connection is a direct connection to the geodatabase. Note: When using OS authentication for the user running the command, you do not specify the -u option when running against a geodatabase in Oracle.
sdetable -o revoke -l buildings,footprints -U OPS$GANESH -A SELECT -i sde:oracle10g -s yourserver
To grant privileges to or revoke privileges from a Windows group, you need to preface the group name with the word "group:". In the following example, UPDATE, INSERT, and DELETE privileges are being revoked from the OS group sdeusers in a DB2 database:
sdelayer -o revoke -l parks,shape -U group:sdeusers -A
UPDATE,INSERT,DELETE -u cbrel
-p open.sesame -d parksnrec -i sde_4000
Use the list operation to get a list of the spatial fields of a feature including the point values for all points that define the shape of the feature.
Specifying a feature ID with the list operation returns the feature's fields and coordinates. Some features may have so many points that you cannot view all the information as it is displayed. To control the display of the feature information, list the detailed feature information with a pagination program or redirect it to a file for later viewing or printing.
The following example displays a feature's detail and pipes the output through the more filter, allowing you to page through the information (only a partial list of points is shown):
sdelayer -o list -l
states,shape -v 11 -i esri_40 -s K9 -D usa -u me -p mo | more
Layer Administration Utility
-----------------------------------------------
Map Layer 41
Feature Entity Type Area
Number of Points 179
Feature Envelope Min X -124.55840
Min Y 41.98779
Max X -116.46944
Max Y 46.23626
Polygon Perimeter 24.78668
Polygon Area 28.18703
------------------------------------------------
Point X Y
------------------------------------------------
1 -121.44041 41.99446
2 -120.87083 41.98779
3 -119.99240 41.98931
4 -119.35065 41.98896
5 -119.30991 41.98924
6 -118.18433 41.99674
7 -117.01791 41.99490
...
To modify a feature class's input/output mode, use the load_only_io and normal_io operations.
You must be the owner of the feature class to change it from normal I/O to load-only I/O mode.
It is recommended that you do not place a versioned feature class that uses binary storage in load only I/O mode because, when you switch back to normal I/O mode, the spatial index will be calculated on a versioned representation of the features. This representation may not match what is stored in the nonversioned f table to which the index gets applied. If this is the case, an error is returned.
When the sdelayer command is used to create a layer (i.e., if the register or add operations are used), the resultant feature class is automatically in normal I/O mode. The load-only I/O mode is provided to make bulk data loading processes more efficient. Use load-only mode when performing large inserts to avoid the continuous update of the feature class's indexes.
For feature classes that use a spatial grid index (SDEBINARY, SDELOB, WKB_GEOMETRY, or feature classes in DB2), if the grid fields are updated while the feature class is in load-only I/O mode, the spatial index is rebuilt with the new grid sizes when you reset the feature class to normal I/O mode. While rebuilding the spatial index table, the feature class is inaccessible to other users. Note: You can change the grid sizes while the feature class is in normal or load-only I/O mode. If you reset spatial indexes while the feature class is in normal I/O mode, the indexes on the spatial index table are dropped while the spatial index is being re-created..
When the feature class is in normal I/O mode, the envelope is automatically updated whenever a feature that extends the current envelope is added. The envelope is not updated while the feature class is in load-only I/O mode but is recalculated to the full extent when the feature class is reset to normal I/O mode.
These examples show the parcels feature class being moved into load only mode then back to normal I/O mode.
sdelayer -o load_only_io -l victoria,parcels -u av -p mo -i esri_40
sdelayer -o normal_io -l victoria,parcels -u av -p mo -i esri_40
When the feature class is returned to normal I/O mode, the spatial index table and database indexes are rebuilt. If the operation does not complete successfully for any reason, the feature class is left in load-only I/O mode.
When a feature class is in load-only I/O mode, the unique index is removed from the feature class's spatial column. When the index is absent, it is possible to enter nonunique values into the spatial column with an application not created with the ArcSDE C- or Java application programming interface (API). Therefore, no applications besides ArcSDE or applications created with the ArcSDE C- or Java API should ever update the spatial column. Database administrators should be aware of the increased vulnerability of the spatial column when the feature class is in load-only I/O mode.
You can change the geometry storage used in a feature class in geodatabases in Oracle or SQL Server using the migrate operation. This operation changes the geometry storage of the feature class to the geometry storage type in the DBTUNE configuration keyword you specify with the -k option. For geodatabases in Oracle, you can migrate a feature class from LONG RAW (SDEBINARY) to BLOB (SDELOB), LONG RAW to ST_GEOMETRY, BLOB to ST_GEOMETRY, or SDO_GEOMETRY to ST_GEOMETRY. For geodatabases in SQL Server, you can migrate a feature class from binary (SDEBINARY or OGCWKB) to GEOMETRY or binary to GEOGRAPHY.
ESRI recommends that you create a configuration keyword in the DBTUNE table specifically for the migration. That way, you can be sure you have the GEOMETRY_STORAGE present and set to the correct storage type you need for the migration. Tip: Remember to include a UI_TEXT keyword in the configuration keyword you create if you want to be able to access it from ArcObjects applications.
In the following example, the ST_GEOMETRY configuration keyword is specified to migrate the trees feature class from SDEBINARY to ST_GEOMETRY storage in a geodatabase in Oracle.
sdelayer -o migrate -l trees,shape -k ST_GEOMETRY -u rufus -p
In this example, the GEOMETRY keyword is specified to migrate the quarantine feature class from SDEBINARY to GEOMETRY storage in a SQL Server database.
sdelayer -o migrate -l quarantine,loc -k GEOMETRY -D mdgdb -u chica
You will receive an error message if any of the following is true:
As indicated in the first bullet point, you must first migrate the feature class from basic (low) to high precision. This can be done using the sdelayer command with the alter operation or the ArcGIS Upgrade Spatial Reference geoprocessing tool.
If the business table of the feature class does not have an object ID column, you can either use the alter_reg operation of the sdetable command to add an object ID column or register the table with the geodatabase using the tools in ArcCatalog, which automatically adds an object ID column.
If the feature class was registered as versioned, migrating the feature class to a different geometry storage type also updates the Adds table. If the feature class has archiving enabled, the archive tables are also updated.
When migrating Oracle data from one type to another, you must to be sure there is enough space to store two copies of the data being converted. When data is migrated from one data type to another, a new segment is created in the database to which the data is copied. Once the migration is complete, the metadata gets repointed to the new segment and the old one is deleted. That means that at one point during the migration, there are two copies of the data. Therefore, the database must have enough room to store two copies of the data.
The register operation allows you to create a feature class from a DBMS table that contains a spatial column defined as a user-defined data type. To date, six different implementations of DBMS spatial data types are supported in ArcSDE geodatabases: Oracle Spatial geometry type (SDO_Geometry), Informix Spatial DataBlade (ST_Geometry), DB2 Spatial Extender (ST_Geometry), spatial type for Oracle (ST_Geometry), spatial type for PostgreSQL (ST_Geometry), PostGIS for PostgreSQL (Geometry), Geometry for SQL Server (Geometry), and Geography for SQL Server (Geography). Tables created with one of these spatial data types and populated using the DBMS SQL interface or some other third-party interface can be added to an ArcSDE geodatabase by registering the existing tables as feature classes.
There are certain requirements, specific to each DBMS, that must be met to register a table as a layer with ArcSDE. These include the following:
In the following example, the victoria table is registered with a spatial column named feature (-l), registered user-maintained row ID column of parcel_no (-C), and allowed entity types of area and measure (-e).
sdelayer -o register -l victoria,feature -e aM -C parcel_no,USER
-t ST_GEOMETRY
-x 30,10,1000 -u av -p mo -i esri
Note: If you define a user-maintained row ID then subsequently register the feature class with the geodatabase, ArcGIS will add a new row ID named Object ID, which will supersede the row ID you specified with the sdelayer command. It will also change the data type of your user-defined row ID from a data type of Object ID to a long integer.
In this next example, a table with a PostGIS geometry column is being registered in a PostgreSQL geodatabase. In this case, the -t option specifies the geometry storage used in the table is PG_GEOMETRY and the -g option specifies the spatial index should be an R-tree index. The row ID column is site_id and is maintained by ArcSDE (-C).
sdelayer -o register -l collectionpts,shape -e p -C site_id,SDE -t
PG_GEOMETRY -g RTREE -R 4236
-i 5100 -s poinard -D org -u itsme -p lemmein
In the following example, a user is registering a table that contains an ST_Geometry column to an Oracle database that has SDELOB set as the default geometry storage type. If the user neglects to specify the -t option with ST_GEOMETRY, an error message, -114 SE_WRONG_COLUMN_TYPE, is returned.
sdelayer -o register -l transectpts,geom -e p -C datapt_id,SDE -R
14 -i
sde:oracle10g -s server12
-u nadya -p georgia@planetora
Layer Administration Utility
Error: Wrong column type (-114).
Error: Cannot Create Layer.
Similarly, if you specify the wrong geometry type, a column type mismatch will occur. If, in the previous example, the -k or -t options were specified with SDO_GEOMETRY, layer creation would also fail.
sdelayer -o register -l transectpts,geom -e p -C datapt_id,SDE -t SDO_GEOMETRY -i sde:oracle10g -s server12 -u nadya -p georgia@planetora
Layer Administration Utility
Error: Wrong column type (-114).
Error: Cannot Create Layer.
Be sure the SRID you specify with the -R option is valid; that is, it is present in the SPATIAL_REFERENCES or ST_SPATIAL_REFERENCES table in the geodatabase.
In this example, the bikelane table is registered with an SRID of 2, with 2 being the SRID of the spatial reference in the ST_SPATIAL_REFERENCES table.
sdelayer -o register -l bikelane,lane -e l -C laneid,SDE -t ST_GEOMETRY -R 2 -i 1111
-s server8 -u osopolar -p pescado
If you try to register a table that contains data with multiple SRIDs, registration will fail. The following error example is from attempting to register a table with multiple SRIDs in an Oracle database:
Error: Underlying DBMS error (-51).
Error: Cannot Create Layer.
ORA-20020: Table osopolar.laneid has multiple SRID's defined to different geometries
When registering SDO_Geometry tables, it is recommended you create a spatial index before registering them with ArcSDE.
If, instead, you specify the -G option when you register the table, you need to provide either the coordinate system code for the spatial reference you want to use (this code corresponds to those present in the ArcSDE pedef.h header file) or a file that contains the projection definition you want.
When you use the -R option and a valid SRID, the extent and cluster tolerance of the resultant feature class is based on the spatial reference. If the -x option is not set, the default x- and y- offsets and x,y scale values are 0.0, 0.0, 1.0. If the spatial reference system specified with the -R option is unknown, the cluster tolerance is calculated as 2 times the cell resolution. If you want to specify the x- and y- offsets, scale, and cluster tolerance, specify the -x option with values appropriate to your data. If you have z and m values, you can also specify z- and m- offsets, scales, and cluster tolerances using the -z and -m options respectively.
For a complete list of requirements per geometry storage type, see the following topics in the ArcGIS Server or ArcGIS Desktop help:
ST_Geometry storage in Oracle
ST_Geometry storage in PostgreSQL
The Oracle Spatial geometry type
The PostGIS geometry type
What is the DB2 Spatial Extender?
What is the Informix Spatial DataBlade geometry type?
Microsoft SQL Server spatial types
You can use the stats operation to display statistics about a feature class including feature entity type counts, total number of features, feature ID, the date of the last feature modification, the number of points in the largest feature, minimum and maximum linear feature lengths, minimum and maximum polygon areas, and the feature class envelope. The following command will display statistics for the parcels feature class:
sdelayer -o stats -l victoria,parcels -u av -p mo -i esri_40
The sdelayer command's spatial index statistics operation, si_stats, can help you determine optimum spatial index grid sizes for data stored in the binary type in an Oracle or SQL Server database or the ST_Geometry type in Oracle. Optimum grid cell sizes depend on the spatial size of all features, the variation in spatial feature size, and the types of searches to be performed on the feature class.
Below is a sample output generated by si_stats:
sdelayer -o si_stats -l victoria,parcels -u av -p mo -i esri_40
Layer Administration Utility
--------------------------------------------------------
Layer 1 Spatial Index Statistics:
Level 1, Grid Size 200 (Meters)
|------------------------------------------------------------------|
| Grid Records: 978341 |
|
Feature Records: 627392 |
| Grids/Feature Ratio: 1.56 |
| Avg. Features per Grid: 18.26 |
| Max.
Features per Grid: 166 |
| % of Features Wholly Inside 1 Grid: 59.71 |
|------------------------------------------------------------------|
| Spatial Index Record Count By Group |
|Grids: <=4
>4 >10 >25 >50
>100 >250 >500 |
|--------- ------ ------ ------ ------ ------ ------ ------ ------ |
|Features: 627392 0 0 0 0 0 0 0 |
|% Total: 100% 0% 0% 0% 0% 0% 0% 0% |
|------------------------------------------------------------------|
| |
Level 2, Grid Size 1600 (Meters)
|------------------------------------------------------------------|
| Grid Records: 70532 |
| Shape Records: 36434 |
| Grids/Shape Ratio: 1.94 |
| Avg. Shapes per Grid: 18.21 |
| Max. Shapes per Grid: 82 |
| % of Shapes Wholly Inside 1 Grid: 45.35 |
|------------------------------------------------------------------|
| Spatial Index Record Count By Group |
|Grids: <=4
>4 >10 >25 >50
>100 >250 >500 |
|--------- ------ ------ ------ ------ ------ ------ ------ ------ |
|Features: 35682 752 87 17 3 0 0 0 |
|% Total: 97% 2% 0% 0% 0% 0% 0% 0% |
|------------------------------------------------------------------|
As the output shows, for each defined spatial index level in the feature class definition, the following values and statistics are printed:
The output sample shows spatial index statistics for a feature class that uses two grid levels: one that specifies a grid size of 200 meters; the other, a grid size of 1,600 meters. When a feature requires more than four spatial index records, it is automatically promoted to the next grid level if one is defined. That is, in no case will a feature index generate more than four grid records if more than one grid level exists. If a higher grid level doesn't exist, a feature can have more than four grid records.
In the example above, 627,392 features are indexed through grid level 1. Because the system automatically promotes features that need more than four spatial index records to the next defined grid level, all 627,392 features for grid level 1 are indexed with four grid records or less. Grid level 2 is the last defined grid level, so features indexed at this level are allowed to be indexed with more than four grid records.
At grid level 2, there are a total of 36,434 features and 70,532 spatial index records: 35,682 features are indexed with four grid records or fewer, 752 features are indexed with more than four grid records, 87 features are indexed with more than 10, 17 features with more than 25, and three features with more than 50 grid records. Percentage values below each column show how the features are dispersed through the eight groups.
Note: To get spatial index statistic information in a DB2 database, use the gseidx command provided by DB2. Consult your DB2 documentation on its use.
The truncate operation removes the records from the f table (if the storage type is binary) or deletes the geometry values but does not drop the business table or truncate the attribute columns of the business table. Records for the business table also remain in the ArcSDE geodatabase system tables. In this example, the spatial attributes of the victoria feature class will be truncated.
sdelayer -o truncate -l victoria,parcels -u av -p mo -i esri_80 -N
Home
Copyright © Environmental Systems Research Institute, Inc. 2004 - 2010. |