Oracle error
ORA-04068
ORA-04068: existing state of packages%s%s%s has been discarded
What usually causes it
A package was recompiled while a session held its state (package variables).
What to check first
Retrying the call works. To prevent it, compile during quiet periods or avoid package-level state.
Scripts that help
- Objects changed in the last 24 hoursApplication objects with DDL in the last day. Grants also update LAST_DDL_TIME, so not every row is a code change.
- Invalid objectsEvery invalid object by owner and type, typically left behind by a deployment or patch. The recompile script fixes most of them.