ORA-04061: existing state of package/procedure has been invalidated
OracleWhat does it mean?
The existing state of a called PL/SQL object (package, procedure, function) was invalidated because an object it depends on changed. It is a variant of the state-loss condition accompanied by ORA-04068; the package state held by the session is no longer valid.
Why does it happen?
While a session was using a package, DDL was applied to that package or its dependencies (table structure change, recompilation, grant change). As a result, the session's existing package state was invalidated. Seen in environments with frequent deployments when schema changes are made while the application is running.
How to fix it
The same call usually succeeds on the second attempt (since the state has been reset); catch this error in the application and retry safely. Make schema changes during low application traffic/in a maintenance window. Compile invalid objects in bulk: EXEC DBMS_UTILITY.COMPILE_SCHEMA('APP_SCHEMA'); Designs that minimize package state (global variables) reduce this effect.
More from this engine
- ORA-19804cannot reclaim N bytes disk space from M bytes limit
- ORA-00494enqueue held for too long by 'inst N, osid M'
- ORA-04021timeout occurred while waiting to lock object
- ORA-01466unable to read data - table definition has changed
- ORA-08176consistent read failure; rollback data not available
- ORA-00020maximum number of processes (N) exceeded
- ORA-01113file N needs media recovery