Home » Administration, ORA-HOWTO, Oracle Code

How to recompile all invalid objects Oracle

22 November 2009 708 views No Comment

This query shows all invalid objects in the Oracle database:

SELECT owner, object_name, object_type, STATUS
FROM dba_objects WHERE STATUS='INVALID' ORDER BY owner DESC;

Next is a metaquery that generates all statements to recompile invalid objects:

SELECT 'ALTER '||decode(owner,'PUBLIC','PUBLIC')||' '||
decode(object_type,'PACKAGE BODY','PACKAGE','TYPE BODY','TYPE',object_type)||' '||
decode(owner,'PUBLIC',NULL,owner||'.')||'"'||object_name||'" COMPILE '||
decode(object_type,'PACKAGE BODY','BODY;','TYPE BODY','BODY;',';')
FROM dba_objects WHERE STATUS='INVALID' ORDER BY owner DESC;
Google : How to recompile all invalid objects Oracle
Google Search: How to recompile all invalid objects Oracle
DB Error Code: How to recompile all invalid objects Oracle

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.