DBAtlas · Database operations atlas

ORA-04068: existing state of packages has been discarded

Oracle

What does it mean?

While a running session was using a package's state, the package was recompiled, so that state was invalidated. The package instance held by the session is no longer valid.

Why does it happen?

A package body or specification was recompiled with ALTER/CREATE OR REPLACE while sessions depending on it were active; it usually occurs during application deployment on a live system. Seen together with ORA-04061/04065.

How to fix it

Re-running the call (retry) usually resolves it; on the second attempt the package loads in its new form. Catch ORA-04068 in the application and retry automatically. Apply package changes in maintenance windows when user activity is low. A stateless package design reduces this problem.

Open in DBAtlas →

More from this engine