Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

 

 

 

How to Solve ORA-04068

Oracle Tips from Laurent Schneider

December 17, 2010

 First, let me introduce you my old foe, ORA-04068 :

 Session 1:

 SQL> CREATE OR REPLACE PACKAGE P AS
   2  X NUMBER;Y NUMBER;END;
   3  / Package created.

SQL> exec P.X := 1

PL/SQL procedure successfully completed.

Session 2:

SQL> CREATE OR REPLACE PACKAGE P AS
   2  X NUMBER;Z NUMBER;END;
   3  /

Package created.

 Session 1:

SQL> exec P.X := 2
BEGIN P.X := 2;
END;

*
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package "SCOTT.P" has been invalidated
ORA-04065: not executed, altered or dropped package "SCOTT.P"
ORA-06508: PL/SQL: could not find program unit being called: "SCOTT.P"
ORA-06512: at line 1

Changing the package in session 2 did invalidate the package variable in session 1.  As a result, the system threw an ORA-04068 error.

 And the PRAGMA that saves the world : PRAGMA SERIALLY_REUSABLE

This shows one way to avoid the ORA-04068 under certain circumstances.

Session 1:

 SQL> CREATE OR REPLACE PACKAGE P AS
   2  PRAGMA SERIALLY_REUSABLE;X NUMBER;Y NUMBER;END;
   3  /

Package created.

SQL> exec P.X := 1

PL/SQL procedure successfully completed.

 Session 2:

SQL> CREATE OR REPLACE PACKAGE P AS
   3  PRAGMA SERIALLY_REUSABLE;X NUMBER;Z NUMBER;END;
   2  /

Package created.

Session 1:

SQL> exec P.X := 2

PL/SQL procedure successfully completed.

Oh yes!  Note that the use of the pragma in this situation eliminated the ORA-04068 and the procedure completed successfully.

More information on ORA-04068 is available HERE.

 

 
 
 
Get the Complete
Oracle Tuning Details 

The landmark book "Oracle Tuning: The Definitive Reference Second Edition" has been updated with over 1,150 pages of expert performance tuning tips. It's packed with scripts and tools to hypercharge Oracle 11g performance and you can buy it for 40% off directly from the publisher.
 

 

Download your Oracle scripts now:

www.oracle-script.com

The definitive Oracle Script collection for every Oracle professional DBA

 

   

 

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2017 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks