Re: source of package invalidation
Date: Thu, 12 Mar 2009 20:33:24 +0100
a short rule to aoid those problems is never to reference an object in static pl/sql code for which dynamic code exists with ddl for this object. Once dynamic ddl is coded each access must be done dynamically to avoid dependencies and thus state invalidation caused by the dynamic ddl
> Maybe there is some code, running now and then, that uses NDS (
> execute immediate) to execute some DDL, that in turn invalidates a
> package body of which sessions hold state.
> This code would not show up in DBA_DEPENDENCIES...
> It would give the symptoms you describe.
> Just a thought.
> On Thu, Mar 12, 2009 at 4:39 PM, Stephens, Chris <chris_stephens_at_
> admworld.com> wrote:
> Iíve gotten several private emails that demonstrate I didnít clearly
> explain the problem Iím having.
> The package compiles fine once recompiled. It is my understanding
> that when an attempt is made to execute a procedure or function
> contained in the package, automated compiling should take place and
> the executor should be non the wiser. This is not what we are seeing.
> Instead the application receives the error:
> ORA-04068: existing state of packages has been discarded ORA-04061:
> existing state of package body "PROJECT.PCKG_CHARGECODE" has been
> invalidated ORA-04065: not executed, altered or dropped package body "
> We have added an exception handler in the code to recompile the
> package with ďexecute immediate Ďalter package xxxx compileí;Ē that
> prevents the user from seeing the error but I would like to prevent
> this from being necessary in the first place.
> Also, am I wrong in expecting the compilation to happen automatically?
> This is a 10.2.0.4 database on RHEL 5 by the way.
> From:oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.
> org] *On Behalf Of *Stephens, Chris
> *Sent:* Thursday, March 12, 2009 10:24 AM
> *Subject:* source of package invalidation
> We are seeing packages invalidated in our production database and I
> donít have a clue how to track down the actual cause.
> Iíve taken a look at dba_dependencies and know the potential
> candidates for causing the invalidation but Iím looking to actually
> identify the chain of events that is causing this.
> Is there an oracle event that can be set to generate a trace file for
> something like this?
> Any other ideas on how to track this down?