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.
This is the one 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

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

to check invalid objects use

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



No comments:

Post a Comment