Last active
December 21, 2015 14:19
-
-
Save willis7/6318722 to your computer and use it in GitHub Desktop.
Recompile invalid objects in an Oracle database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set head off | |
set feedback off | |
spool compile.lis | |
select 'alter package '|| owner ||'.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'PACKAGE' | |
and status = 'INVALID' | |
/ | |
select 'alter package '|| owner ||'.'||object_name||' compile body;' | |
from all_objects | |
where object_type like 'PACKAGE BODY' | |
and status = 'INVALID' | |
/ | |
select 'alter trigger '|| owner ||'.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'TRIGGER' | |
and status = 'INVALID' | |
/ | |
select 'alter view '|| owner ||'.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'VIEW' | |
and status = 'INVALID' | |
/ | |
select 'alter materialized view '|| owner ||'.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'MATERIALIZED VIEW' | |
and status = 'INVALID' | |
/ | |
select 'alter type '|| owner || '.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'TYPE' | |
and status = 'INVALID' | |
/ | |
select 'alter procedure '|| owner || '.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'PROCEDURE' | |
and status = 'INVALID' | |
/ | |
select 'alter function '|| owner || '.'||object_name||' compile;' | |
from all_objects | |
where object_type like 'FUNCTION' | |
and status = 'INVALID' | |
/ | |
spool off | |
set head on | |
set feedback on | |
@compile.lis | |
set lines 2000 | |
select substr(object_name,1,30) object_name, owner, object_type, status, timestamp from all_objects where status !='VALID'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment