Thursday, April 26, 2012

Compile INVALID objects


There are few different ways to compile invalid objects in a database, different people use different ways to compile (like utlrp.sql, alter command,etc)

This is the method i used recently in my environment.

 SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
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

Check current invalid object counts:

SQL> select object_type,count(*) from dba_objects where status='INVALID' group by object_type;

SQL >  Spool run_invalid.sql

SQL> select 'ALTER ' || OBJECT_TYPE ||' '||owner||'.'||OBJECT_NAME || ' COMPILE;' from dba_objects where owner='SYSFM' and status = 'INVALID' ;

SQL>  Spool off;

SQL>  @run_invalid

Check again counts:

SQL> select object_type,count(*) from dba_objects where owner='MYUSER' and status='INVALID' group by object_type;



0 comments:

Post a Comment

Auto Scroll Stop Scroll