Skip to main content

Add the ST_Geometry type to an Oracle database

Available with Standard or Advanced license.

The database administrator can add the Esri ST_Geometry type, subtype, and functions to an Oracle database using the Create Spatial Type geoprocessing tool or a Python script that calls the CreateSpatialType ArcPy function.

After you add the ST_Geometry type to your database, you can use it to store spatial data.

Both the tool and the function create a user named sde in the database. The sde user owns the ST_Geometry type, subtypes, functions, and tables.

Note:

The ST_Geometry library requires the Microsoft Visual C++ Redistributable Package (x64) when deployed on a Microsoft Windows server. See ArcGIS requirements for using Oracle for the package version required. If this package is not present on the server, download it from the Microsoft site and install it.

Use the Create Spatial Type geoprocessing tool

To run the Create Spatial Type geoprocessing tool to install the ST_Geometry type in an Oracle database, complete the following steps:

  1. Download the st_shapelib (Windows) or libst_shapelib (Linux) library from My Esri, and move it to a location on the Oracle server.

    Use the library appropriate for your Oracle server's operating system.

    The directory on the server where you place the library must be accessible from the client machine from which you will run the Create Spatial Type tool or script. If you place the library on a UNIX or Linux machine, ensure that the database administrator has read access to the directory and privileges to run the library file.

    If the option to download is not present, contact your ArcGIS organization administrator.

  2. Open a project in ArcGIS Pro, open the Catalog pane, and connect to the database as an Oracle sys database administrator.

    A database connection (.sde) file is created in your project folder.

  3. Open the Create Spatial Type geoprocessing tool.

    You can use the Search window to search for the tool or open the tool from the Workspace toolset of the Data Management toolbox.

  4. Add the database connection you created in step 2 to the Input Database Connection parameter text box.

  5. Provide the password for the sde database user in the SDE User Password parameter text box.

  6. Optionally, in the Tablespace Name parameter text box, provide the name of a tablespace to use as the sde user's default tablespace.

    The Create Spatial Type tool creates a 400 MB tablespace in the Oracle default storage location. To control where the tablespace is placed or the size of the tablespace, create the tablespace in Oracle first, and specify the existing tablespace in the Tablespace Name parameter. The tool will set this pre-existing tablespace as the default for the sde user.

  7. For the ST_Geometry Shape Library Path parameter, provide the path to the directory on the Oracle server where you placed the libst_shapelib.so or st_shapelib.dll file, including the name of the file.

    For example, if you placed the libst_shapelib.so file in the libraries directory on a Linux server named boxy, you would type /boxy/libraries/libst_shapelib.so.

  8. Click Run.

The ST_Geometry type, subtypes, and functions are created in the schema of the sde user, and an entry is made in Oracle for the shape library.

If you intend to use the ST_Transform function to perform geographic transformations, you must copy the pedata folder from your ArcGIS Pro installation directory, place it on the Oracle server, and set a PEDATAHOME environment variable on the server that points to that location.

Use ArcPy functions

On any ArcGIS Pro or ArcGIS Server machine, use the CreateDatabaseConnection ArcPy function to create a database connection file (.sde) that connects to the Oracle database as the Oracle sys user. Next, use the .sde file and the CreateSpatialType ArcPy function to create the Esri ST_Geometry type, subtype, and functions in the database.

  1. Download the st_shapelib (Windows) or libst_shapelib (Linux) library from My Esri, and move it to a location on the Oracle server.

    Ensure that you use the library appropriate for your Oracle server's operating system.

    The directory on the server where you place the library must be accessible from the client machine from which you will run the script. If you place the library on a UNIX or Linux machine, ensure that the database administrator has read access to the directory and privileges to run the library file.

  2. Run the CreateDatabaseConnection function to create .sde file.

    You must connect as the Oracle sys user, and you must save credentials.

    In the following example, the connection file, named dbadminconnection, is created in a directory named TempFiles. The Oracle instance is oserve, and sys user credentials are provided and saved with the file.

    import arcpy
    
    arcpy.management.CreateDatabaseConnection(
       "/user/TempFiles",
       "dbadminconnection.sde",
       "ORACLE",
       "oserve/ORCL",
       "DATABASE_AUTH",
       "sys",
       "D0B3tt3r",
       "SAVE_USERNAME"
    )
    
  3. Run the CreateSpatialType ArcPy function to install the ST_Geometry type in the Oracle database.

    In this example, the connection file from the previous step is used. The password and tablespace are provided for the sde user (pw0rd4sde and sdetblsp respectively). The location of the ST_Geometry library is specified.

    import arcpy
    
    arcpy.management.CreateSpatialType(
       "suserconnection.sde",
       "pw0rd4sde",
       "sdetblsp",
       "/net/oserve/ora/shape/libst_shapelib.so"
    )
    

The ST_Geometry type, subtypes, and functions are created in the schema of the sde user and an entry is made in Oracle for the shape library.

If you intend to use the ST_Transform function to perform geographic transformations, you must copy the pedata folder from your ArcGIS Pro installation directory, place it on the Oracle server, and set a PEDATAHOME environment variable on the server that points to that location.