Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

Oracle invalid Objects Tips


Oracle Database Tips by Donald Burleson

Oracle is complex and interconnected and changing things can cause some database objects to become "invalid".

This script will display a list of Oracle invalid objects:

break on c1 skip 2

set pages 999

col c1 heading 'owner' format a15
col c2 heading 'name' format a40
col c3 heading 'type' format a10

ttitle 'Invalid|Objects'

select
   owner       c1,
   object_type c3,
   object_name c2
from
   dba_objects
where
   status != 'VALID'
order by
   owner,
   object_type;

Whenever an oracle object is marked as invalid because of a table, that has been changed, the Oracle professional can change the object to valid by using a SQL*Plus script.

This script will search the Oracle data dictionary for invalid objects, create a spool file with the names of the invalid objects, then invoke a script to re-compile all of these invalid objects. The following script should be used whenever a change is made to an Oracle table or index, or any other Oracle object, since the DBA must ensure that all objects are valid and executable.

We now have a supported script to perform this function of re-compiling invalid objects. The utility is called Recompile PL/SQL, or RP for short. The script is called utlrp.sql and is located in the $ORACLE_HOME/rdbms/admin/ directory. However, most experienced Oracle DBAs prefer a home-made script for this purpose.

Recompiling invalid objects

Although invalid PL/SQL modules get automatically recompiled on use, it is useful to run this script ahead of time (e.g. as one of the last steps in your migration), since this will either eliminate or minimize subsequent latencies caused due to on-demand automatic recompilation at runtime.

You can invoke the utl_recomp package to recompile invalid objects:

EXEC UTL_RECOMP.recomp_serial('schema name');

Oracle highly recommends running this script towards the end of of any migration/upgrade/downgrade.

set heading off;
set feedback off;
set echo off;
Set lines 999;

Spool run_invalid.sql

select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
and
object_type in ('PACKAGE','FUNCTION','PROCEDURE')
;
spool off;
set heading on;
set feedback on;
set echo on;

@run_invalid.sql

Oracle invalid objects sometimes have dependencies, so it may be necessary to run the Oracle invalid objects recompile repeatedly.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.