Error: ORA-04061: existing state of package body "SDE.ST_GEOMETRY_SHAPELIB_PKG" has been invalidated
When accessing the Spatial Type for Oracle using SQL, the following error message is displayed:
ORA-04061: existing state of has been invalidated
ORA-04061: existing state of package body "SDE.ST_GEOMETRY_SHAPELIB_PKG" has been invalidated
ORA-06508: PL/SQL: could not find program unit being called
The name of the package body (SDE.ST_GEOMETRY_SHAPELIB_PKG) may be different from time to time, but the cause of the error is the same. The error number and format of the error message will not change.
Oracle has discovered a package or type body is invalid, and the object cannot be automatically recompiled. This issue has been identified on some Oracle servers where one database object has changed and has dependent database objects which become invalid.
Solution or Workaround
The invalid object needs to be recompiled to become valid again. Oracle 10g includes a mechanism to recompile some invalid objects when they are accessed for the first time. However, this mechanism does not always work and errors of this sort can occur. If this error is encountered, the invalid packages and any invalid type bodies can be manually recompiled.
After recompiling, be sure to start a new Oracle session before verifying that recompiling solved the problem.
To find invalid objects owned by the user SDE, connect to Oracle with SQL*Plus and execute the following statement:
SELECT OBJECT_NAME, OBJECT_TYPE
WHERE OBJECT_TYPE IN ('PACKAGE', 'PACKAGE BODY', 'TYPE', 'TYPE BODY')
To recompile a type body, use the following command:
ALTER TYPE <object_name> COMPILE BODY;
To recompile a package body, use the following command:
ALTER PACKAGE <object_name> COMPILE BODY;