Home » SQL & PL/SQL » SQL & PL/SQL » ORA-04068: existing state of packages has been discarded (Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production, Linux Redhat)
ORA-04068: existing state of packages has been discarded [message #677209] Fri, 30 August 2019 10:29 Go to next message
fixxxer
Messages: 35
Registered: August 2014
Member
We use edition based redefinition.

We have a package that has absolutely no package variables, constants, cursors. It simply has 1 procedure within the package.

I've checked to see if the package has state, and it does not (Execute the package procedure from session 1, compile the package in session 2, run the package procedure again in session 1 - no problem).

Out application team are interacting with this package procedure via JDBC. They are intermittently getting "ORA-04068: existing state of packages has been discarded".

Honestly stuck on trying to diagnose the problem. Enabled DDL audit on, and there is nothing running at that time that would indicate the cause of this issue.

Just wanting to see if anyone has come across this before?

Let me know if you need any more details.
Re: ORA-04068: existing state of packages has been discarded [message #677222 is a reply to message #677209] Mon, 02 September 2019 05:05 Go to previous messageGo to next message
cookiemonster
Messages: 13685
Registered: September 2008
Location: Rainy Manchester
Senior Member
Are you sure JDBC is complaining about the package you think it is?
Because if the situation is really as you describe the only thing I think is that you've hit an oracle bug - in which case you really need to talk to oracle support.
Re: ORA-04068: existing state of packages has been discarded [message #677225 is a reply to message #677222] Mon, 02 September 2019 05:16 Go to previous messageGo to next message
fixxxer
Messages: 35
Registered: August 2014
Member
Thanks for the reply.

Yeah, the error message references the same package every time:

ORA-04068: existing state of packages has been discarded
ORA-04065: not executed, altered or dropped package body "XXX.XXX"
ORA-06508: PL/SQL: could not find program unit being called: "XXX.XXX"

We have opened an SR with ORACLE, as it is strange behavior. Feel it may be something to do with Edition Based Redefinition.
Re: ORA-04068: existing state of packages has been discarded [message #677226 is a reply to message #677225] Mon, 02 September 2019 05:18 Go to previous messageGo to next message
cookiemonster
Messages: 13685
Registered: September 2008
Location: Rainy Manchester
Senior Member
Does the package call other packages?
Cause it may well be that the call to the package in question is throwing the last two errors because some other package further down the stack is throwing the first error.
Re: ORA-04068: existing state of packages has been discarded [message #677227 is a reply to message #677226] Mon, 02 September 2019 05:24 Go to previous message
fixxxer
Messages: 35
Registered: August 2014
Member
Yeah it calls some instrumentation packages, for debug e.t.c. However, we have exception handling that would wrap the error in our own formatting. The application is failing to even invoke the package, as it's state is no longer valid (even though it is written as a stateless package).

It succeeds on the 2nd call after it re-instantiates the package.
Previous Topic: How to remove ordinal suffixes after the numbers
Next Topic: ORA-29913 ORA-29400 KUP-00554
Goto Forum:
  


Current Time: Thu Oct 17 00:18:59 CDT 2019