how to compile invalid objects in oracle applications

# Run seperately in 2 SQL sessions

REM Spooling invalid objects other than PACKAGE BODY,JAVA CLASS & JAVA SOURCE
set pages 2000
set head off
spool comp_rest.sql
select 'ALTER '||DECODE(object_type,'UNDEFINED','SNAPSHOT',object_type)||' '||owner||'.'||object_name||' compile;'
from dba_objects
where status='INVALID' and object_type NOT IN( 'PACKAGE BODY','JAVA CLASS','JAVA SOURCE');
spool off
set head on
@comp_rest

REM Spooling invalid PACKAGE BODies

set pages 2000
set head off
spool comp_body.sql
select 'ALTER PACKAGE '||owner||'.'||object_name||' compile BODY;' from
dba_objects where status='INVALID' and object_type = 'PACKAGE BODY';
spool off
set head on
@comp_body

REM spooling invalid JAVA objects
spool alter_java.sql

select 'ALTER JAVA SOURCE "' || owner||'.'||object_name || '" COMPILE;'
from dba_objects
where object_type = 'JAVA SOURCE' and status = 'INVALID';

select 'ALTER JAVA CLASS "' ||owner||'.'|| object_name || '" RESOLVE;'
from dba_objects
where object_type = 'JAVA CLASS' and status = 'INVALID';

spool off
@alter_java.sql
set heading on
select owner,count(object_name) "INVALIDS " from dba_objects where status='INVALID' group by owner;

No comments:

Post a Comment