Existing state of packages has been discarded...

Hi all,
I know this is a long shot and probably you need more details to help, but please take a look in case you've encountered something similar before... It is a pretty interesting problem.
Ok, I have two packages, say, A and B. Package A is composed of utility functions, and package B makes use of those functions. These packages are compiled as part of the schema installation, where package A is always compiled first. I also have unit test scripts for each procedure in each package.
Now, after schema installation, when I run the unit test for some procedures in package B, I get the following error:
ORA-04068: existing state of packages has been discarded
ORA-04065: not executed, altered or dropped stored procedure "my_schema.pkg_A"
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at "my_schema.pkg_B", line 18
ORA-06512: at line 5
Some interesting notes:
- I can run the unit test of all pkg A procedures. I can also describe the package. Which seems to me that pkg A has been compiled successfully.
- If I log into a sqlplus session, run the unit test for a pkg B procedure, which then fails with the above message. Then I run a unit test of a pkg A proceudre, which succeeds. Then I run the same pkg B unit test, it will work then. And all the other pkg B procedures will work from this point on.
- But if I log out from sqlplus session, and log in again, and run the pkg B procedure unit test again, it will fail as before.
- Certain procedures in pkg B have no problem running. They also call pkg A procedures. However, the pkg A procedures are always invoked in the where or order by clauses in these cases. The pkg B procedures that call pkg A procedure in a standalone statement will always fail.
- The fact above made me suspect that function-based indexes (which were created using pkg A procedures) were used in cases where pkg B procedures work. And that in those cases pkg A hasn't really been invoked. However, when I monitor those indexes using v$object_usage, it shows they are not used. (I have a very small set of data.)
- After schema installation, if I compile pkg B again, the problem will disappear.
Does this ring a bell to anyone? Any help will be appreciated.
Thanks,
Gloria Chung

Thanks for reading and responding.
I'm compiling both header and body for both packages.
I ran the following query after schema installation, which returned 0:
select count(*) from user_objects where status='INVALID';
The schema installation involved putting new copies of both package A and B.
If I only recompile the package body after installation, it will still 'cure' the problem. I.e. if I run any of the affected pkg B unit test, it will run successfully.
It is assumed there is no schema before 'schema installation'.
Thanks,
Gloria

Similar Messages

  • Existing state of package has been discarded...

    If application is running and it uses cursors/prepared statements for procedures and functions in packages and
    new version of package is inserted into database, then an error message 'existing state of package has
    been discarded' is raised.
    However, there are packages where there is no 'existing state of package'. And for application purposes
    new version of this package should be used without this error message.
    Enhancement: There should be a pragma stating that package is 'stateless' and new version ot it is used if it
    exists without an error situation.
    This feature would be beneficial e.g. in 3-tier architecture where servers are running constantly.
    Or can this be accomplished with any other way (without parsing statement with every call ) ?

    When session references a package for the first time package is instantiated in session memory. If package is recompiled since, Oracle assumes it possibly changed and package instance in session memory is no longer valid. That's why any reference to that package made by such session will raise an error.
    Session 1:
    SQL> create or replace
      2  package pkg1
      3  is
      4  g_n number;
      5  procedure p1;
      6  end;
      7  /
    Package created.
    SQL> create or replace
      2  package body pkg1
      3  is
      4  procedure p1
      5  is
      6  begin
      7  for rc in (select * from emp) loop
      8  dbms_output.put_line(rc.empno);
      9  end loop;
    10  end;
    11  end;
    12  /
    Package body created.
    SQL> exec pkg1.p1;
    PL/SQL procedure successfully completed.
    SQL>This instantiated package PKG1 is session1. Then session 2:
    SQL> alter package pkg1 compile body;
    Package body altered.
    SQL> Back to session 1:
    SQL> exec pkg1.p1;
    BEGIN pkg1.p1; END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "SCOTT.PKG1" has been invalidated
    ORA-04065: not executed, altered or dropped package body "SCOTT.PKG1"
    ORA-06508: PL/SQL: could not find program unit being called: "SCOTT.PKG1"
    ORA-06512: at line 1
    SQL>SY.

  • ORA-04068: existing state of packages has been discarded

    I work on an order entry system that is up 24x7 running Oracle version 8.0.5. I want to compile a fix to a procedure contained in a package body. I only will be recompiling the package body. Since the package body has no dependent objects, I should not invalidate any stored procedures that call this procedure in my package. However, should I worry about causing an "ORA-04068: existing state of packages has been discarded" error? What causes this error and when does it occur?

    Please ensure that DBMS_ROWID is created in SYS schema and not in any ordinary user's schema. If it exists in any user's schema drop it from there.
    If the problem persists, drop the package from sys schema as well and run two script files in the following order:
    1) ORACLE_HOME\rdbms\admin\dbmsutil.sql
    2) ORACLE_HOME\rdbms\admin\prvtutil.plb

  • Problem with ORA-04061: Existing state of string has been invalidated Tips

    hi,
    i'm a oracle developer and work in a IRON Industry, in our industry we have several levels of data communications, in our level 2, all of software developed on .NET platform, and in level 3 we have oracle tools such as form builder, we have a connector called ICC that developed in .Net platform, ICC gathers datas from level 2 on tcp/ip and write in a oracle database(level 3), a BEFORE INSERT trigger wrote on a table that ICC insert into it datas and calls several packages in the level 3, we have oracle database 10g R2, in this database if state of one of dependent procedures or functions that called in main package changed to INVALID then this trigger doesn't work, if any body have any suggestion to change our solution please help me.
    Thanks alot

    Arash wrote:
    hi,
    i'm a oracle developer and work in a IRON Industry, in our industry we have several levels of data communications, in our level 2, all of software developed on .NET platform, and in level 3 we have oracle tools such as form builder, we have a connector called ICC that developed in .Net platform, ICC gathers datas from level 2 on tcp/ip and write in a oracle database(level 3), a BEFORE INSERT trigger wrote on a table that ICC insert into it datas and calls several packages in the level 3, we have oracle database 10g R2, in this database if state of one of dependent procedures or functions that called in main package changed to INVALID then this trigger doesn't work, if any body have any suggestion to change our solution please help me.
    Thanks alotThis probably is not specific to your .NET application. If you can reproduce this from SQL*Plus please post this over on one of the OTN database forums, as there a lot more DBAs over there who could potentially help you.

  • Existing state of package discarded

    Hi,
    How can i avoid the error "Existing state of package discarded.." error.. my package is called from java front end and it gives error in front end. once, i refresh the page it starts working...
    Thanks,
    JP

    This is caused by having package level variables in your package and then something that the package depends (dependencies) are changing in some way which invalidates the package.
    If there are no package level variables then the package will automatically re-compile and be usable, but if there are package level variables then these are considered to be the "state" variables for that users session. When the package becomes invalidated for whatever reason, then it is basically saying "I can't recompile the package because you will lose the state of your copy of the variables" which is why the error is generated, and once you have been given the error, if you access it again it will cause it to recompile anyway.
    One solution is to remove all package level variables (and constants) to a seperate package spec and alter the code of the package to reference them in that package spec.
    ;)

  • SQL Plus session - "schema.package" has been invalidated on making any chng

    Hi
    I am in the process of testing a stored procedure. Whenever I make changes to the procedure I am executing it from the SQL Plus session. But whenever I make a change to the procedure - i have to close that particular SQL Plus session and open another one. I get the message:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-04061: existing state of has been invalidated
    ORA-04061: existing state of package body
    "schema.package" has been invalidated
    ORA-04065: not executed, altered or dropped package body
    Is there a way that I do not have to open a new SQL Plus session everytime I make change to the package?

    It does not help :(. I get this problem in a SQL+ session only when I make a change in a JDev session. I have to log off the SQL+ session and log back in and it is OK again without re-compling anything. I don't have a problem with two SQL+ session. Isn't that strange?
    ben

  • How to check the last time a package has been compiled?

    How to check the last time a package has been compiled from sqlplus?

    LAST_DDL_TIME column in DBA_OBJECTS.

  • My broadband package has been downgraded without m...

    I wrote on here a couple of days ago as I was really annoyed at BT for cancelling my order for the Home Hub 4 which they ordered on my behalf - the order has disappeared off the MY BT page and I've no idea what happened, can only speculate. However, I've now logged back into My BT and found my broadband package has been downgraded from Unlimited Broadband to More Broadband!!! As far as I can tell, this means I've now got a limit of 40GB per month - I use that in a week!!
    What the hell are BT playing at? Has anyone got these problems or have I been landed with the idiots??
    Seriously considering cancelling the contract even though we are only weeks into it.
    Sort it out BT

    Hi
    I am sorry to see you are having problems
    I suggest you contact live chat at this link they should be able to help you
    http://bt.custhelp.com/app/contact/c/2902/?s_intcid=con_intban_sanda_contact_us_chat_from_forums
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Not encrypted dot1x packet from 0012.f0b9.87c3 has been discarded

    I have a very basic config to setup wireless on on an 857W router.
    When I get connected the log fills up the the following message.
    Not encrypted dot1x packet from 0012.f0b9.87c3 has been discarded
    What is causing this?
    Config below
    version 12.4
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    hostname Router
    boot-start-marker
    boot-end-marker
    no aaa new-model
    dot11 ssid TESTSSID_1
    vlan 10
    max-associations 10
    authentication open
    authentication key-management wpa
    wpa-psk ascii 0 mywpapskpwd
    dot11 ssid TESTSSID_2
    vlan 20
    max-associations 10
    authentication open
    authentication key-management wpa
    wpa-psk ascii 0 mytestpassword
    no ip dhcp use vrf connected
    ip dhcp excluded-address 192.168.100.1
    ip dhcp pool HOME_1
    network 192.168.100.0 255.255.255.0
    default-router 192.168.100.1
    ip dhcp pool HOME_2
    network 10.20.0.0 255.255.255.0
    default-router 10.20.0.3
    ip cef
    archive
    log config
    hidekeys
    bridge irb
    interface ATM0
    no ip address
    shutdown
    no atm ilmi-keepalive
    dsl operating-mode auto
    interface FastEthernet0
    interface FastEthernet1
    spanning-tree portfast
    interface FastEthernet2
    spanning-tree portfast
    interface FastEthernet3
    interface Dot11Radio0
    no ip address
    no ip route-cache cef
    no ip route-cache
    encryption vlan 10 mode ciphers tkip
    encryption vlan 20 mode ciphers tkip
    broadcast-key change 60
    ssid TESTSSID_1
    ssid TESTSSID_2
    speed basic-1.0 basic-2.0 basic-5.5 basic-6.0 basic-9.0 basic-11.0 basic-12.0 basic-18.0 basic-24.0 basic-36.0 basic-48.0 basic-54.0
    channel 2452
    station-role root
    world-mode dot11d country GB both
    no cdp enable
    bridge-group 1
    bridge-group 1 subscriber-loop-control
    bridge-group 1 spanning-disabled
    bridge-group 1 block-unknown-source
    no bridge-group 1 source-learning
    no bridge-group 1 unicast-flooding
    interface Dot11Radio0.10
    encapsulation dot1Q 10 native
    no ip route-cache
    bridge-group 10
    bridge-group 10 subscriber-loop-control
    bridge-group 10 spanning-disabled
    bridge-group 10 block-unknown-source
    no bridge-group 10 source-learning
    no bridge-group 10 unicast-flooding
    interface Dot11Radio0.20
    encapsulation dot1Q 20
    no ip route-cache
    bridge-group 20
    bridge-group 20 subscriber-loop-control
    bridge-group 20 spanning-disabled
    bridge-group 20 block-unknown-source
    no bridge-group 20 source-learning
    no bridge-group 20 unicast-flooding
    interface Vlan1
    ip address 10.7.12.219 255.255.255.0
    interface Vlan10
    no ip address
    ip virtual-reassembly
    ip tcp adjust-mss 1400
    bridge-group 10
    hold-queue 100 out
    interface Vlan20
    no ip address
    ip virtual-reassembly
    ip tcp adjust-mss 1400
    bridge-group 20
    hold-queue 100 out
    interface BVI10
    ip address 192.168.100.1 255.255.255.0
    ip nat inside
    ip virtual-reassembly
    interface BVI20
    ip address 10.20.0.3 255.255.255.0
    ip nat inside
    ip virtual-reassembly
    ip forward-protocol nd
    ip route 0.0.0.0 0.0.0.0 10.7.12.254
    no ip http server
    no ip http secure-server
    control-plane
    bridge 10 protocol ieee
    bridge 10 route ip
    bridge 20 protocol ieee
    bridge 20 route ip
    line con 0
    no modem enable
    line aux 0
    line vty 0 4
    login
    scheduler max-task-time 5000
    end
    Router#

    Too funny... I get clients complain to me about issues and they have drivers that are from 2003 or 2004.
    Now all you have to do is make sure all other devices are on the same firmware. Makes troubleshooting sooooooo much easier.

  • My apple I'd has been discarded for security reasons. The site asks me to give my email and they would send me the further instruction. But no Emil has arrived so far. Since January. And I did requested help multiple times. :( any ideas where can I solve

    My apple I'd has been discarded for security reasons. The site asks me to give my email and they would send me the further instruction. But no Emil has arrived so far. Since January. And I did requested help multiple times. :( any ideas where can I solve

    Who discarded the Apple ID? Apple? or You?
    Did you answer the Security Questions? Is the backup email accurate? Have you tried contacting them?

  • States eprint job has been received but never prints but will print my daily comics.

    ok, my printer will not print my pics from my phone, but has before. I send the pic to the printer, my email states that the eprint has been received but the printer never comes through to print. I looked on the HP site and it stated that the eprint had failed, does not explain why and I cant contact anyone to ask for tech support. I have my printer set up to print my daily comics, that it has no problems printing. I have printed off several pics from my phone off this printer, however after the first few days the printer decided what it wanted to print. Some would come through and some wouldn't.  Also I put in a memory card from a camera to print pics and it refuses to read it, any memory card. I have even tried the memory card from my phone in an adapter and it still will not read. Please if anyone knows how to correct these problems please help me!? Im really thinking about returning this printer.  Thank you

    Did you get your problem solved?
    If not, I may be able to bring it to the attention of someone that could help you.
    I work on behalf of HP.

  • Iphoto 9.4.2 states facebook album has been deleted

    When I try to upload fotos to Facebook the upload stops/crashes and then I receive a message stating that some random facebook album has been deleted. hen I check the photos remain but the upload is now stopped and I must redo.
    Is there a fix?

    Thanks LN.
    I tried.  It would not download.  A drop down notice said an error had occurred and to return to the purchase page; which I have done on numerous occasions.  (What I am to do on the purchase page I am not sure, other than to click on purchases and see that the same iPhoto download is available.  By the way, this was not purchased.  It just showed up with two other items free items, which did download nicely.)
    Otto

  • Am having a problem locating autocad lt 2012 edition on mac app store. anyone had any success with this. all the websites state that it has been launched on mac app store last week

    has anyone been able to purchase the autocad 2012 lt edition that apparently is available on mac app store. dont seem to be able to find it?

    This article was posted on August 16th: http://blogs.wsj.com/digits/2011/08/16/autodesk-adopts-apple-app-store-for-mac-s oftware/
    Perhaps this coming Tuesday.

  • "Not encrypted dot1x packet has been discarded"

    I've got Cisco 851 and Wireless client (notebook). I've created this config (see attachements), but receive the error (see attachements).
    Settings on the client:
    Security type: WPA-Personal
    Encryption type: TKIP
    And the same security key.
    What have I done wrong?

    Your configuration looks fine, and the log even states that your client associates. Do you maybe have a setting wrong on the laptop? Do you have access with it despite the error?

  • Phone states apple id has been disabled. How do I fix?

    when trying to download apps phone says that apple ID has ben disabled

    If changing your password does not work then contact itunes support

Maybe you are looking for

  • Cannot clear screen saver picture after sleep.  A restart is required to resume work.

    A three year old iMac owned by a friend freezes after sleep.  It seems the screen saver picture will not clear.  A force quit or finder restart does not work.  Only way to resume work is to restart the computer.

  • How to use .ttf font in muse ?

    Hi, I have a question, I want to make a website using thai font (which is Angsana New  ). I have the font which in .ttf I have the font installed in my system and overtime I upload the website the font will exported as an image. Can someone help me b

  • Why does CC desktop app keep my macbook in high power mode?

    I own Master Collection CS6 and I have creative cloud desktop app installed. The Adobe Updater updated itself as expected. What is unexpected is that the new CC desktop app keeps my laptop (MacBook Pro) in high power mode, even when there are no appl

  • I can not delete a film  ! Please Help Me !

    Dear all, I have a problem, I have a film on my desktop which is locked. I can open and see the film, but when I try to delete it, it is impossible. What can I do ? Thank you for your help

  • My computer keeps starting up by itself - Help

    Just wanted to know if anyone can tell me what's wrong. My blue & White G3 keeps restarting when it is shut down. Is there something I need to check or uncheck. I am running 10.4 right now and it was just installed about a week ago. This computer has