So I have been running a PLSQL procedure just fine, and compiling with no errors. I made one change to my procedure, and it still compiles fine, but now when I run it, I get this error:
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package body "SCHEMA.XP_COVER_PAGEP" has been invalidated
ORA-04065: not executed, altered or dropped package body "SCHEMA.XP_COVER_PAGEP"
ORA-06508: PL/SQL: could not find program unit being called: "SCHEMA.XP_COVER_PAGEP"
ORA-06512: at "SCHEMA.XP_ST_002180", line 141
ORA-06512: at line 1
Any ideas what this could be? The change I made was so insignificant that I doubt it could have caused this error. Thank you in advance for your help!
In some cases with RAC, the ORA-04068 error can be suppressed with this command: alter system set "_disable_fast_validate"=true scope=both; If a remote dependent object has been altered through a DDL statement then invoking the procedure/package can result ORA-04068: existing state of packages has been discarded .
What this means is that the user tried to call a procedure that was not available due to the procedure being dropped or modified in an incompatible manner. It can also occur when the procedure or program was compiled, but contained errors.
When a session makes use of a package that session retains some state of the package. If that package is recompiled the next time the same session references the package you'll get that error.
To avoid this make sure you disconnect each session that may have used the package or have the session do a DBMS_SESSION.RESET_PACKAGE to reset the package state.
If you recompile a package specification all dependant objects are invalidated. A dependant object is any view, package specification, package body, function or procedure that references any of the declarations in the recompiled package specification.
Also, as pointed out by darreljnz, sessions usually retain references to the state of packages they have accessed, causing an ORA-04068: existing state of packages has been discarded
the next time the session tries to reference the package.
This latter behaviour is a real nuisence and makes it necessary to either write code to retry operations or to close all active sessions after installing a new version of a package (effectively restarting the application/service). Bottom line: It makes it harder to install hotfixes.
Use pragma serially_reusable
in you Package and its Body.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With