February 28, 2008

Find & Recompile invalid objects

-- Find invalid objects
select OWNER , OBJECT_TYPE , OBJECT_NAME,STATUS
from dba_objects
where status != 'VALID'
order by owner, object_type;

-- Recompile invalid objects
select 'ALTER ' OBJECT_TYPE ' ' OWNER '.' OBJECT_NAME ' COMPILE;'
from dba_objects
where status = 'INVALID'

No comments: