Skip to main content

Configure extproc to access ST_Geometry in Oracle

The ST_Geometry SQL functions in Oracle use a shared library that Oracle accesses through the Oracle external procedure agent, or extproc. The Oracle external procedure framework requires access to the physical ST_SHAPELIB library file to allow you to do any of the following:

Preparatory steps

The ST_Geometry library is created for specific operating systems. Sign in to My Esri and download the library file specific to the operating system where Oracle is running and specific to the ArcGIS client version you are using.

The Oracle instance must have access to the ST_Geometry library. Place the library on the Oracle machine in a directory that the Oracle instance can access.

Before you configure the Oracle extproc file, complete the following steps:

  1. Download the ST_Geometry library from My Esri and place it in a directory on the Oracle machine.

    Note:

    Download or copy the correct library for your Oracle operating system.

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

    When you run the Create Spatial Type geoprocessing tool to enable ST_Geometry in an Oracle database, or you run the Create Enterprise Geodatabase or Enable Enterprise Geodatabase geoprocessing tool to create a geodatabase, the tools set a default path for the ST_SHAPELIB library.

  2. Connect from an SQL client to the Oracle instance as the sde user, and run the following SQL to confirm that the path set by the tool matches the location of the ST_Geometry library:

    SELECT file_spec
     FROM user_libraries
     WHERE library_name = 'ST_SHAPELIB';
    

    If the path returned from this does not match the location of the ST_Geometry library file, re-create the library after configuring extproc.

Configure extproc

Configure the Oracle extproc.ora file to point to the location of the ST_Geometry library file. Consult the Oracle documentation for Oracle SQL syntax.

  1. Make a backup of the extproc.ora file on the Oracle server.

  2. Open the extproc.ora file in a text editor and alter it to point to the location of the st_shapelib.dll (Windows) or libst_shapelib.so (Linux or UNIX) library.

  3. Save and close the extproc.ora file.

    You may need to restart the Oracle instance for it to identify changes in the extproc.ora file.

  4. If you changed the location of the ST_Geometry library file from the default location or no location was set, create or re-create the ST_SHAPELIB library in the Oracle database.

    You must connect to the database as the sde user to create or re-create the ST_Geometry library.

  5. If you re-created the library, recompile the sde.st_geometry_shapelib_pkg package.

    Any clients that need access to the library (including web services) must reconnect to the database.

Validate the extproc configuration

You can query the ST_Geometry library to ensure that extproc can access it.

  1. Sign in to an Oracle SQL client.

  2. Run the following query:

     SELECT sde.ST_AsText(
       SDE.ST_Geometry('POINT (10 10)', 0)
      )
     FROM dual;
    

    If extproc is properly configured, the query will return the following:

    SDE.ST_ASTEXT(SDE.ST_GEOMETRY('POINT(1010)',0))
    -------------------------------------------
    POINT (10.00000000 10.00000000)
    

    If extproc is not properly configured, the query returns one or more of the following error messages:

    ORA-06520: PL/SQL: Error loading external library

    ORA-06522: Unable to load DLL

    ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 0

    ORA-06512: at "SDE.ST_GEOMETRY_OPERATORS", line 68

Upgrades and the ST_Geometry library

You must download or copy new versions of the library file to obtain the fixes and improvements included in new versions of the library whenever you upgrade the geodatabase in Oracle or need to upgrade the ST_Geometry type in an Oracle database.

Oracle may mark the library as invalid when it is replaced or after you upgrade the Oracle instance. Oracle sometimes recompiles invalid database objects automatically when the objects are referenced by a client, but there are cases when they are not compiled automatically.

The ST_Geometry library is owned by the sde user. To check the status of the library (and all files owned by the sde user), sign in to an SQL client as the sde user and run the following statement:

SELECT object_name, object_type
  FROM USER_OBJECTS
  WHERE STATUS = 'INVALID';

If the sde.st_geometry_shapelib_pkg package body is returned in the list of invalid objects, recompile it as described in step 5 of the Configure extproc section above.

If more than one object is invalid, you can recompile all objects in the same schema. See the Oracle documentation for the privileges required and instructions to recompile objects.