ORA-04061

Can somebody tell why these errors are coming sometimes, though this package (and its dependent packages) are valid.
Its not appearing each time, it just pops up some time.
ORA-04061: existing state of has been invalidated
ORA-04061: existing state of package "CHECK_DATA" has been invalidated
ORA-04065: not executed, altered or dropped package "CHECK_DATA"
ORA-06508: PL/SQL: could not find prog
------------------------------------------------------------------------------

check the status of the package as soon as you get the error.
select owner, object_name, status
  from all_objects
where object_type = 'PACKAGE'
   and object_name = 'CHECK_DATA'for some reason some objects such as tables might be altered that is being used at the package.

Similar Messages

  • ORA-04061: existing state of  has been invalidated

    Hi,
    In Development Database Information
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE     11.2.0.2.0     Production"
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Solution required for this oracle error
    I am getting this Error - ORA-04061: existing state of has been invalidated
    package pkg1 -> Main pkg
    pkg1 calling another package pkg2
    i am modified and recompiled the package pkg2.
    After executing the package PKG1 it throwing this Error ORA-04061.
    i am checking user_objects and it status are VALID.
    In both package doesnt have the any variables.
    Please suggest the above issue.
    Thanks in advance.
    Regards,
    Sudhakar P

    BluShadow wrote:
    Karthick_Arp wrote:
    Sudhakar P wrote:
    Hi,
    how to reload it into memory - SGA ?.Please suggest me.
    Regards
    Sudhakar P.I guess you dint get my point. So may be read this {message:id=3488533}:) Saves me re-posting it.Still remember reading it way back then :). I much appreciate the time you spend on explaining it in detail.

  • Getting ORA-20002: 3825: Error '-4061-ORA-04061: Error from business event

    Hi,
    I have defined custom subscription to the iRecruitment business event oracle.apps.per.api.assignment.update_apl_asg . In this custom subscription i am launching a custom workflow to send Notification about offer acceptance or Application Submission information.
    The subscription package is in my custom schema. When i do transaction to invoke the subscription i am getting below error.
    ORA-20002: 3825: Error '-4061 - ORA-04061: existing state of has been invalidated ORA-04061: existing state of package
    "XXPJ.XXPJ_IREC_EXT_COMPONENTS_PK" has been invalidated ORA-04065: not executed, altered or dropped package "XXPJ.PT in Package irc_party_swi Procedure
    registered_user_application.
    I need to bounce the Workflow services and Apache server to clear this error and functionality work for some time, again after doing 3-4 transaction i get the same error.
    Any help on this appreciated.
    Regards,
    Ram

    From error: "existing state of has been invalidated ORA-04061" It only can happen when current db session finds this package as INVALID. Now when which cases it can find ir INVALID:
    1) One case is that: some other db session "really" compiled your current package. Please note: even if the status is VALID but other db session will see that as INVALID in first attempt and in second attempt, current db session will try to recompile that on-the-fly.
    2) Or Some other db session compiled or altered dependent objects, I mean objects on which your current package is dependent on.

  • 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.

  • Inbound Connection Timeout ORA-3136

    Hi,
    Certain users are getting locked automatically and when I checked the Alert log file I found
    WARNING: inbound connection timed out (ORA-3136)
    I referred to the Metalink doc : 465043.1.
    I increase the SQLNET.INBOUND_CONNECT_TIMEOUT to 120, and still the users are getting locked, there is no network delay, there is no database performance degradation.
    However, I found ORA 600 error in the alert log file along with the following errors
    ORA-00600: ?ف? ??? ???غمش ?غك???? [pfri.c: pfri8: plio mismatch ], [], [], [], [
    ORA-04061: غف م?ف ?غ??ظظ فµ ??غ? package body "HR_BASE.PN$LEAVE_BALANCE" ?غفك?ك?
    ORA-04065: غف م?ف ?غ?µطم?ش ?ف ???مغ ?ك ??ظ?? package body "HR_BASE.PN$LEAVE_BALA
    NCE"
    Sat Jan 3 14:35:01 2009
    Errors in file /u01/app/oracle/admin/central/udump/central_ora_5902.trc:
    ORA-00600: ?ف? ??? ???غمش ?غك???? [pfri.c: pfri8: plio mismatch ], [], [], [], [
    Sat Jan 3 14:35:24 2009
    Errors in file /u01/app/oracle/admin/central/udump/central_ora_5902.trc:
    ORA-00600: ?ف? ??? ???غمش ?غك???? [pfri.c: pfri8: plio mismatch ], [], [], [], [
    Sat Jan 3 14:40:01 2009
    Thread 1 advanced to log sequence 1987 (LGWR switch)
    Current log# 3 seq# 1987 mem# 0: /oradb/oradata/central/redo03a.log
    ORA-12012: ??? طم ?غ?µطم? ?غ?غم غغك?مط? 37
    ORA-01403: غف م?ف ?غ??ك? ?غل ?م? ?م?µ??
    ORA-06512: ?µ? "HR_BASE.BSH$PAYROLL", line 143
    ORA-06512: ?µ? line 1
    Sun Jan 25 12:26:47 2009
    Errors in file /u01/app/oracle/admin/central/bdump/central_j000_6523.trc:
    ORA-12012: ??? طم ?غ?µطم? ?غ?غم غغك?مط? 37
    ORA-01403: غف م?ف ?غ??ك? ?غل ?م? ?م?µ??
    ORA-06512: ?µ? "HR_BASE.BSH$PAYROLL", line 143
    ORA-06512: ?µ? line 1
    Sun Jan 25 12:30:48 2009
    Errors in file /u01/app/oracle/admin/central/bdump/central_j000_6523.trc:
    ORA-12012: ??? طم ?غ?µطم? ?غ?غم غغك?مط? 37
    ORA-01403: غف م?ف ?غ??ك? ?غل ?م? ?م?µ??
    ORA-06512: ?µ? "HR_BASE.BSH$PAYROLL", line 143
    ORA-06512: ?µ? line 1
    Sun Jan 25 12:31:38 2009
    Thread 1 advanced to log sequence 3184 (LGWR switch)
    PLEASE Help!!!

    Thanks for your reply,
    Could you please tell me how to recompile a set of objects, can I recompile the objects using utlrp.sql script?
    and there are some other errors as well
    *ORA-00604: error occurred at recursive SQL level 1
    ORA-01801: date format is too long for internal buffer
    RMAN-08132: WARNING: cannot update recovery area reclaimable file *
    for all those errors I need to contact Oracle support?

  • ORA-04068 on 11g RAC does not resolve automatically !

    Did you ever get the combination of these three ORAs?
    ORA-04068: Existing state of package has been discarded
    ORA-04065: Not executed, altered or dropped stored procedure <PROCEDURE_NAME>
    ORA-06508: PL/SQL: Could not find program unit being called: <PROCEDURE_NAME>
    *1st I checked for invalid objects in the database, there are none!*
    *2nd Then I checked the metalink note 1058873.1 that describes a similar error:*
    In hecheck output, we see that the objects affected are listed as "Dependency$ p_timestamp > > mismatch for VALID objects".
    Also, the following script can be used for finding the mismatches:
    set pagesize 10000
    column d_name format a20
    column p_name format a20
    select do.obj# d_obj,do.name d_name, do.type# d_type,
    po.obj# p_obj,po.name p_name,
    to_char(p_timestamp,'DD-MON-YYYY HH24:MI:SS') "P_Timestamp",
    to_char(po.stime ,'DD-MON-YYYY HH24:MI:SS') "STIME",
    decode(sign(po.stime-p_timestamp),0,'SAME','*DIFFER*') X
    from sys.obj$ do, sys.dependency$ d, sys.obj$ po
    where P_OBJ#=po.obj#(+)
    and D_OBJ#=do.obj#
    and do.status=1 /*dependent is valid*/
    and po.status=1 /*parent is valid*/
    and po.stime!=p_timestamp /*parent timestamp not match*/
    order by 2,1;However, the query returned 0 rows.
    *3rd Then I read about similar errors on http://oraclequirks.blogspot.com/2007/03/ora-04061-existing-state-of-package-has.html*
    The article describes the state of package being invalidated when one user calls a procedure in a package that has a global variable and changes the value of the global variable and then when a developer compiles that package, another user will get the error ORA-04061: existing state of package has been invalidated the first time he calls the procedure, but the second time it will work without returning errors.
    However, my error is persistant and Oracle can't resolve it automatically.
    Here's how the error occurs:
    - I have a PACKAGE that has a global variable and procedures
    - User1 connects to Instance1 and calls a procedure inside the PACKAGE. The procedure sets the value of the global variable by calling a function outside the package.
    For example: L_GLOBAL_VAR := OUTSIDE_FUNCTION(30);
    - The developer compiles the PACKAGE
    - User1 can continue working normaly - he receives the 1st error by Oracle informing him that the value of the global variable has changed (normal behaviour), but the second time he calls the procedure inside the PACKAGE, no errors are reported.
    - User2 connects to the second instance of the RAC (Instance2)
    - When User2 tries to call the same procedure, he constantly gets ORA errors (ORA-04068, ORA-04065, ORA-06508), like this:
    ORA-04068: Existing state of package has been discarded
    ORA-04065: Not executed, altered or dropped stored procedure "OUTSIDE_FUNCTION"
    ORA-06508: PL/SQL: Could not find program unit being called: "OUTSIDE_FUNCTION"
    ORA-06512: at "PACKAGE2", line 1920
    ORA-06512: at "PACKAGE2", line 265The PACKAGE2 has a procedure which is being called at line 265, and that procedure calls the function OUTSIDE_FUNCTION at line 1920.
    Symptoms:
    - User2 cannot correct the error by repeatingly calling the PACKAGE procedure.
    - The developer cannot resolve the issue by recompiling the PACKAGE.
    - The developer can only temporarily resolve the issue by recompiling the OUTSIDE_FUNCTION. After doing it, the User2 does not receive errors. However, if the User2 reconnects, the error returns.
    - The solution is to recompile the PACKAGE2. After doing it, the User2 does not receive errors.
    However, I'm totally confused by this Oracle behaviour.
    I told the developers that they shouldn't compile packages while there are users working on the database (a possible solution), but as a developer I know that is very very hard on a 24/7 production database, especially if there are some urgent bugs to resolve etc.
    We were working on a single instance Oracle 9i database before upgrading to Oracle 11g RAC (11.2.0.1.0), and we never had similar problems.
    I would be very grateful for any suggestions regarding this issue.
    Thanks,
    Daniel

    Hi P. Forstmann,
    Thanks for your answer. I've read about the edition based redefinition but if I understand it correctly, that's not exactly what I'm looking for.
    For example, if a connected user reports a bug that prevents her from doing her work, the developers should resolve that bug ASAP and recompile the objects in question, which should affect the connected users.

  • Webservice based on PL/SQL function - ORA-04068

    Hi,
    we have a problem here with PL/SQL based webservices. If the PL/SQL package gets invalid then the very first request to the webservice results in:
    java.sql.SQLException:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package "TUG_NEW.WBSERVICES" has been invalidated
    ORA-04065: not executed, altered or dropped package "TUG_NEW.WBSERVICES"
    ORA-06508: PL/SQL: could not find program unit being called ORA-06512: at line 1
    Any workarounds? Shouldn't the package become recompiled automatically when it was invalid?
    Thanks, Christian

    the caller gets an error on the first request. from the second request on it works ... indicates the package is not yet recompiled when the first request is sent. When the second request is sent, the package has been recompiled.

  • Invalidated Packages ORA-04068

    I'm using 7.0 sp2 with Oracle 9.2.0.2 thin driver and am frequently getting the
    below exception. Typcially I will run a unit test (junit), find a problem with
    an Oracle package, fix it and then rerun without bouncing WebLogic. In previous
    versions this worked fine.
    Typically Oracle gives you get this message when you are holding onto a reference
    to an Oracle object (stored proc, etc.) that Oracle has invalidated due to a change
    you have made. For example, if you have an open cursor you would be forced to
    close and reopen.
    My guess was that now WebLogic is caching some of the statements this was causing
    the problem so I set the preparedstatementcachesize to 0 but it has not helped.
    This has been slowing my development as now I have to either retry N times (N
    varies) until the problem goes away or bounce the server after each Oracle change.
    Any help would be appreciated. Thanks.
    <JDBCConnectionPool ConnLeakProfilingEnabled="true"
    DriverName="oracle.jdbc.driver.OracleDriver" MaxCapacity="10"
    Name="TuscanyJDBCPool" PreparedStatementCacheSize="0"
    Properties="user=tuscany;password=qqq;dll=ocijdbc8;protocol=thin"
    RefreshMinutes="5" Targets="myserver" TestTableName="dual" URL="jdbc:oracle:thin:@foxlau36:1521:ITVD3"/>
    <JDBCTxDataSource EnableTwoPhaseCommit="false"
    JNDIName="TuscanyJtsDataSource" Name="TuscanyJtsDataSource"
    PoolName="TuscanyJDBCPool" RowPrefetchEnabled="true" Targets="myserver"/>
    java.lang.RuntimeException: ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "TUSCANY.TITLE_INSTALLMENT" has been
    invalidated

    After talking with BEA support it looks like this is an Oracle issue. Any open
    connection in the pool that has made a such a call will be marked as invalid by
    Oracle. To get rid of the invalid connections you can reset the connection pool
    (or bounce the server).
    java weblogic.Admin -url t3://localhost:7001 -username %WLS_USER% -password %WLS_PW%
    RESET_POOL poolname
    Oracle suggests catching the exception ard retrying.
    Thanks.
    "Paul Krinsky" <[email protected]> wrote:
    >
    I'm using 7.0 sp2 with Oracle 9.2.0.2 thin driver and am frequently getting
    the
    below exception. Typcially I will run a unit test (junit), find a problem
    with
    an Oracle package, fix it and then rerun without bouncing WebLogic. In
    previous
    versions this worked fine.
    Typically Oracle gives you get this message when you are holding onto
    a reference
    to an Oracle object (stored proc, etc.) that Oracle has invalidated due
    to a change
    you have made. For example, if you have an open cursor you would be forced
    to
    close and reopen.
    My guess was that now WebLogic is caching some of the statements this
    was causing
    the problem so I set the preparedstatementcachesize to 0 but it has not
    helped.
    This has been slowing my development as now I have to either retry N
    times (N
    varies) until the problem goes away or bounce the server after each Oracle
    change.
    Any help would be appreciated. Thanks.
    <JDBCConnectionPool ConnLeakProfilingEnabled="true"
    DriverName="oracle.jdbc.driver.OracleDriver" MaxCapacity="10"
    Name="TuscanyJDBCPool" PreparedStatementCacheSize="0"
    Properties="user=tuscany;password=qqq;dll=ocijdbc8;protocol=thin"
    RefreshMinutes="5" Targets="myserver" TestTableName="dual" URL="jdbc:oracle:thin:@foxlau36:1521:ITVD3"/>
    <JDBCTxDataSource EnableTwoPhaseCommit="false"
    JNDIName="TuscanyJtsDataSource" Name="TuscanyJtsDataSource"
    PoolName="TuscanyJDBCPool" RowPrefetchEnabled="true" Targets="myserver"/>
    java.lang.RuntimeException: ORA-04068: existing state of packages has
    been discarded
    ORA-04061: existing state of package body "TUSCANY.TITLE_INSTALLMENT"
    has been
    invalidated

  • ORA-4068 Existing stage of package discarded - Techniques of avoid variable

    Hi all,
    I need to ‘strip’ the state from a package (let’s say PKG_MAIN). I’ve already transform all constants into functions but I have difficulties in finding the best solution for the variables. Most of the variables are collections and I cannot use temporary tables to replace them (performance issues). As well I have tried creating a package (PKG_VARIABLES) for all variables but, as you probably know, this is not a ‘fix’ because changing the PKG_VARIABLES will trigger, when calling the PKG_MAIN, the ORA-4068 anyway.
    Any ideas??
    Cheers,
    Harada

    [standard response for package state]
    Packages tend to fail because of their "package state". A package has a "state" when it contains package level variables/constants etc. and the package is called. Upon first calling the package, the "state" is created in memory to hold the values of those variables etc. If an object that the package depends upon e.g. a table is altered in some way e.g. dropped and recreated, then because of the database dependencies, the package takes on an INVALID status. When you next make a call to the package, Oracle looks at the status and sees that it is invalid, then determines that the package has a "state". Because something has altered that the package depended upon, the state is taken as being out of date and is discarded, thus causing the "Package state has been discarded" error message.
    If a package does not have package level variables etc. i.e. the "state" then, taking the same example above, the package takes on an INVALID status, but when you next make a call to the package, Oracle sees it as Invalid, but knows that there is no "state" attached to it, and so is able to recompile the package automatically and then carry on execution without causing any error messages. The only exception here is if the thing that the package was dependant on has changes in such a way that the package cannot compile, in which case you'll get an Invalid package type of error.
    And if you want to know how to prevent discarded package states....
    Move all constants and variables into a stand-alone package spec and reference those from your initial package. Thus when the status of your original package is invlidated for whatever reason, it has no package state and can be recompiled automatically, however the package containing the vars/const will not become invalidated as it has no dependencies, so the state that is in memory for that package will remain and can continue to be used.
    As for having package level cursors, you'll need to make these local to the procedures/functions using them as you won't be able to reference cursors across packages like that (not sure about using REF CURSORS though.... there's one for me to investigate!)
    This first example shows the package state being invalided by the addition of a new column on the table, and causing it to give a "Package state discarded" error...
    SQL> set serveroutput on
    SQL>
    SQL> create table dependonme (x number)
      2  /
    Table created.
    SQL>
    SQL> insert into dependonme values (5)
      2  /
    1 row created.
    SQL>
    SQL> create or replace package mypkg is
      2    procedure myproc;
      3  end mypkg;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body mypkg is
      2    v_statevar number := 5; -- this means my package has a state
      3
      4    procedure myproc is
      5      myval number;
      6    begin
      7      select x
      8      into myval
      9      from dependonme;
    10
    11      myval := myval * v_statevar;
    12      DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
    13    end;
    14  end mypkg;
    15  /
    Package body created.
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALID
    SQL>
    SQL>
    SQL> alter table dependonme add (y number)
      2  /
    Table altered.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    BEGIN mypkg.myproc; END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "SCOTT.MYPKG" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "SCOTT.MYPKG"
    ORA-06512: at line 1
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALIDAnd this next example shows how having the package variables in their own package spec, allows the package to automatically recompile when it is called even though it became invalidated by the action of adding a column to the table.
    SQL> drop table dependonme
      2  /
    Table dropped.
    SQL>
    SQL> drop package mypkg
      2  /
    Package dropped.
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL> create table dependonme (x number)
      2  /
    Table created.
    SQL>
    SQL> insert into dependonme values (5)
      2  /
    1 row created.
    SQL>
    SQL> create or replace package mypkg is
      2    procedure myproc;
      3  end mypkg;
      4  /
    Package created.
    SQL>
    SQL> create or replace package mypkg_state is
      2    v_statevar number := 5; -- package state in seperate package spec
      3  end mypkg_state;
      4  /
    Package created.
    SQL>
    SQL> create or replace package body mypkg is
      2    -- this package has no state area
      3
      4    procedure myproc is
      5      myval number;
      6    begin
      7      select x
      8      into myval
      9      from dependonme;
    10
    11      myval := myval * mypkg_state.v_statevar;  -- note: references the mypkg_state package
    12      DBMS_OUTPUT.PUT_LINE('My Result is: '||myval);
    13    end;
    14  end mypkg;
    15  /
    Package body created.
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        VALID
    SQL>
    SQL> alter table dependonme add (y number)
      2  /
    Table altered.
    SQL>
    SQL> select object_name, object_type, status from user_objects where object_name = 'MYPKG'
      2  /
    OBJECT_NAME
    OBJECT_TYPE         STATUS
    MYPKG
    PACKAGE             VALID
    MYPKG
    PACKAGE BODY        INVALID
    SQL>
    SQL> exec mypkg.myproc
    My Result is: 25
    PL/SQL procedure successfully completed.

  • Error while executing a procedure in Package

    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package "PLLODS.LK" has been invalidated
    ORA-04065: not executed, altered or dropped package "PLLODS.LK"
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1Why did this error arise when I changed a package and recompiled?

    This errors occurs when a package was executed in session A, compiled in session B, and then executed again in session A. The package executed in session A is in Oracle buffer, but its definition was changed in session B (which session A is unaware of). Now session A uses the old definition of the package but Oracle checks what is in buffer to the new definition and finds a difference. Therefore, it generates an error:
    ORA-04068: existing state of packages has been discarded
    and other related errors.
    Just execute the procedure (in the package) again and you should not see the error again.
    Make sure the stae of the package is valid, that is, when it was recompiled, the package compiled successfully.
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for Developers and DBAs

  • Execute immediate and dynamic sql

    Dear all;
    Just curious....Why do developers still use dynamic sql..and execute immediate, because I always thought dynamic sql were bads and the use of execute immediate as well...
    or am I missing something...

    There are no 'bad' things and 'good' things.
    There are 'correctly used' and 'incorrectly used' features.
    It depends what you want to do.
    One simple example: Oracle 11.2 - you write a package that fetches data from range interval partitioned table (a new partition is created automatically every day when new key values are inserted). If you use static SQL then whenever Oracle creates a new partition then your package gets invalidated and has to be compiled. If your package is heavily used (by many sessions running in parallel) then you may get this:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "PACKAGE.XXXXX" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "PACKAGE.XXXXX" Nice, isn't it?
    You can avoid this kind of problems by simply using dynamic SQL. You break dependency with the table and your package is not invalidated when new partition is created.

  • SALES ORDER LINE IS CANCELLED BUT DELIVERY DETAIL IS SHOING AS BACKORDERED

    SALES ORDER LINE IS CANCELLED BUT still the DELIVERY DETAIL IS showing as BACKORDERED it should be in cancelled
    status.The Sales order (only one ex:3904854) is cancelled , however order in shipping transactions screen indicates order is on backorder.
    at that time of order cancellation the line level workflow error out due to the Workflow package is inactive .
    I tried to resubmit the error out workflow using retry option from the responsibility “Workflow Administrator” the workflow is completed with forcible option but still the delivery detail is in back order status not changing it to cancel status.
    Error Name :-4068 [Error Process Error: WF Error Message: ORA-04068: existing state of packages has been discarded  
              ORA-04061: existing state of package body "APPS.XRX_SUPPLIES_NEW_WF_PKG" has been invalidated    
              ORA-04065: not executed, altered or dropped package body "APPS.XRX_SUPPLIES_NEW_WF_PKG"                         
              ORA-06508: PL/SQL: could not find program unit being called: "APPS.XRX_SUPPLIES_NEW_WF_PKG" [Error Process           Error: 3114: Activity 'WFERROR/R_ERROR_RETRY' is not a process.]
    Error Stack: Wf_Engine_Util.Function_Call(XRX_SUPPLIES_NEW_WF_PKG.XRX_CLOSE_LINE_DETAILS, OEOL, 55098479, 195982, RUN)
    [Error Process Error:   Wf_Engine.CreateProcess(WFERROR, WF5147218, R_ERROR_RETRY) ]

    Mohan
    You need a simple script to get the status corrected. Log an SR or search metalink for the script. I am sure there is one out there (if you search with the orphan reservations). This script supported, but not exactly targeted at your problem But it will solve it. You can log an SR and confirm.
    Thanks
    Nagamohan

  • Redwood User Account error on Job

    Hi All,
    We currently had all our BWP jobs fail with the following error:
    JCS-00503: OS account SYSJCS does not exist or is disabled on BRSAPPRDBWPV2
    JCS-00315: job must run under OS equivalent of Oracle account SYSJCS
    We run our oracle database on a Windows 2003 environment and also our Redwood/SAP servers are on a Windows 2003 server.
    The job itself users "USER" account.
    The only way we could get the jobs to start was by restarting the BWP Redwood services, and this worked fine.
    Also want to state the we had the following issue at the sametime which was flagged up to us in "messages":
    resubmit.update_job:
    ORA-04061: existing state of package body "SYSJCS.CHAIN" has been invalidated
    ORA-04065: not executed, altered or dropped package body "SYSJCS.CHAIN"
    ORA-06508: PL/SQL: could not find program unit being called: "SYSJCS.CHAIN"
    All our BWP process chains are executed via the RUN BW CHAIN script, which is copied and renamed for the process chain.
    We have tried to replicate the error in our dev environment but it worked fine. RFC points nothing at all.. Any help would be much appreciated. OSS note has been raised...
    Thank You
    Jazz

    Hi Jazz,
    The SYSJCS.CHAIN package is not used for BI Process Chains, only for CPS Chains. So the invalidation must have come from another source.
    When this error occurs, as long as there are sessions started before the package has been re-validated (state reinitialized), you can continue to run into this error until all sessions have been restarted. The extend of the error depends on the package being reinitialized (how often it is used and the dependencies it has) and the session that needs to call it.
    I think the error may already have been there before you did the chain import and just happened to surface shortly after the import.
    Regarding your other questions:
    1. RSI_IMPORT_BW_CHAINS or RSI_IMPORT_BW_CHAIN_DEFINITIONS:
    the second one is only needed if you want to display the process chain definitions in the web interface before the chain is even running in CPS (in the job monitor you only see the processes that have started); if you do not use that, RSI_IMPORT_BW_CHAINS is enough
    2. How would you go about maintaining BW process chains in Redwood (CPS)?
    This is a question that every customer runs into at some point. First, you currently can not change a process chain definition in the BI system from CPS. Then there are cases where you probably want to leave the process chain structure intact (typically on the deepest level: drop index, do some work, recreate indexes). And there are other cases where it can be useful to bring some logic to CPS (typically on all levels where you have process chain within process chain in BI, ie. on all but the deepest levels).
    For this last case, which is of course the most interesting for CPS, it can be very valuable to recreate the BI "meta-chain" structure in a CPS job chain.
    So here you replace the BI "meta-chain" calling several BI process chains by a Cronacle job chain still calling some of the BI process chains (the ones on the deepest levels).
    Now you can add all the CPS extras for error handling, retries, cross system dependencies, (external) events, alerting, etc. etc. on each and every point in the CPS job chain, so you get a lot more information, intervention and recovery points on your BI process than you would when running the entire thing in one big BI Process Chain (triggered from CPS or not does not matter).
    Typically the customer's decision here mainly depends on the advantages that can be achieved, especially if there are service levels to be met on the reports that need to be delivered from BI and these deadlines tend to get tighter by the month.
    By reducing the total runtime of the process or reducing the number of errors that occur or if they occur, the amount of work to fix it, you can save a lot of time, and thus money.
    Hope this helps.
    Regards,
    Anton.

  • A package is considered invalid from another package when it isn't

    Hi all,
    I have two packages, A and B. I have unit test for both packages. B uses some procedures from A. After they are compiled (A first, then B), when I run the unit test for B in sqlplus, I get
    ORA-04068: existing state of packages has been discarded
    ORA-04065: not executed, altered or dropped stored procedure "my_schema.A"
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at "my_schema.B", line 886
    ORA-06512: at line 6
    But if I run the unit test for A, it works perfectly (so I think A has been compiled correctly and could be found in the database).
    For those who have read my post yesterday titled 'existing state of packages has been discarded', this is the same problem. Sorry for posting twice but I really need to get this working.
    Thanks.
    Gloria Chung

    This shouldn't be a problem if you are running the unit tests in the same session as you are recompiling the packages.
    Basically, package A must be storing values in package level variables. Like this...
    SQL1> CREATE OR REPLACE PACKAGE ap AS
    2 FUNCTION f RETURN number;
    3 END;
    4 /
    Package created.
    SQL1> CREATE OR REPLACE PACKAGE BODY ap AS
    2 FUNCTION f RETURN number IS
    3 BEGIN
    4 RETURN 2;
    5 END;
    6 END;
    7 /
    Package body created.
    SQL1> CREATE OR REPLACE PACKAGE bp AS
    2 FUNCTION f RETURN NUMBER;
    3 END;
    4 /
    Package created.
    SQL1> CREATE OR REPLACE PACKAGE BODY bp AS
    2 n NUMBER;
    3 FUNCTION f RETURN NUMBER IS
    4 BEGIN
    5 n := n + ap.f;
    6 RETURN n;
    7 END;
    8 BEGIN
    9 n := 0;
    10 END;
    11 /
    Package body created.
    SQL1>
    Now we can use that in another session...
    SQL2> var x number
    SQL2> exec :x := bp.f
    PL/SQL procedure successfully completed.
    SQL2> print x
             X
             2
    SQL2>So far so good. Now in the first session we run ...
    SQL1> CREATE OR REPLACE PACKAGE BODY bp AS
      2    n NUMBER;
      3    FUNCTION f RETURN NUMBER IS
      4    BEGIN
      5       n := n * ap.f;
      6       RETURN n;
      7    END;
      8  BEGIN
      9      n := 4;
    10  END;
    11  /
    Package body created.
    SQL1> back in session two...
    SQL2> exec :x := bp.f
    BEGIN :x := bp.f; END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "APC.BP" has been invalidated
    ORA-04065: not executed, altered or dropped package body "APC.BP"
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1
    SQL2>aaargh! disaster! But all we have to do is ...
    SQL2> conn apc/apc
    Connected.
    SQL2> var x number
    SQL2> exec :x := bp.f
    PL/SQL procedure successfully completed.
    SQL2> print x
             X
             8
    SQL2> I'm not saying its satisfactory, because obviously it isn't. But I don't see what else Oracle can do.
    Cheers, APC

  • Issues with the SQL wrapper scripts created with the DB adapter

    Hi All,
    We have the wrapper sql scripts created with the DB adapter configurations which are being used to invoke the stored procedures.
    To give you a background on the wrapper sql scripts-The Adapter Configuration wizard generates a wrapper API when a PL/SQL API has arguments of data types, such as PL/SQL Boolean, PL/SQL Table, or PL/SQL Record.
    These two SQL files are saved in the same directory where the WSDL and XSD files are stored, and are available in the Project view.
    The issue we are facing now is that whenever the associated package or the procedure structure undergoes a change we see an error as given below:
    An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/Application1_ABC_ESB/DBADP_Update_Out.wsdl [ DBADP_Update_Out_ptt::DBADP_Update_Out(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'DBADP_Update_Out' failed due to: Error while trying to prepare and execute an API. An error occurred while preparing and executing the APPS.XXIRIS_SOA_R_WRAPPER.XXIRIS_AR_CUST_K$ API. Cause: java.sql.SQLException: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body "APPS.XXIRIS_AR_CUST_K" has been invalidated ORA-04065: not executed, altered or dropped package body "APPS.XXIRIS_AR_CUST_K" ORA-06508: PL/SQL: could not find program unit being called: "APPS.XXIRIS_AR_CUST_K" ORA-06512: at "APPS.XXIRIS_SOA_R_WRAPPER", line 1 ORA-06512: at line 1 [Caused by: ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body
    In such cases we need to either execute the wrapper scripts again or refresh the connection pool in case the wrapper sql scripts for that procedure are not available.
    In some cases we see that the first instance errors out.However the second request and the subsequent requests after that goes through successfully.
    Please do let me know if anyone has faced such issues before.
    Any inputs in this regard would be of great help.
    Thanks in advance!
    Deepthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I stumbled on a link in the oracle forum which says that the "create or replace package XXX" at the start of the PL/SQL procedure when run seems to intermittently cause the ORA-04068: existing state of packages has been discarded problem.
    As per the solution suggested an “alter package XXX compile" can be executed after the changes are made and then we would no longer get the error in BPEL/ESB and dont have to bounce the server too.
    __http://forums.oracle.com/forums/thread.jspa?threadID=185762_
    However the above solution does not seem to resolve the issue.
    Any help in this regard would be highly appreciated.
    Thanks,
    Deepthi

Maybe you are looking for

  • Mac Mini HDMI Samsung HDTV colors washed out

    Hoping someone can point me in the right direction. Just upgraded from a 2009 Mac Mini to a new one. Using HDMI, the colors are washed out and off (greenish purplish) at the default 1360 x 1768. If I pick one of the other (like 720p) the colors are r

  • CRM generated tables

    Hi All,    I need to know which are the dynamically generated tables in CRM. In which application components in CRM generates this tables and what are its namespace. Its pretty urgent. Could you let me know this info plz. Regards, Prasad

  • How do i get google back

    when ever I type a search in to the address bar the search uses bing - I want Google back

  • XL REPORTER: Balance sheet by project code

    Dear all, I am trying to use XL report to create BS report by project code (in columns).  I could get it to work 90%.  I am now stuck at the point where i need to separately show the amount when there's no project code assigned.  When i use column ex

  • How we can get Uppercase Macron entities in XML...

    Hi good morning to everybody, We are currently working in XML job in InDesignCS2 MAC. In the job Times postscript font is the base font. And we need macron entities for this job. In this Times Postscript font special entity characters are not availab