COL OBJECT_NAME FORMAT A30
SET ECHO OFF FEED OFF HEAD OFF VERIFY OFF TERMOUT OFF
SPOOL C:\RECOMP.SQL
SELECT 'ALTER ' || DECODE( OBJECT_TYPE, 'PACKAGE BODY',
'PACKAGE ' || OWNER || '.' || OBJECT_NAME || ' COMPILE BODY;',
OBJECT_TYPE || ' ' || OWNER || '.' || OBJECT_NAME || ' COMPILE;' ) INVALIDOS
FROM DBA_OBJECTS
WHERE STATUS = 'INVALID'
AND OWNER = UPPER( '&&1.' )
/
SPOOL OFF
SET ECHO OFF FEED 6 HEAD ON
SPOOL C:\RECOMP.LOG
@c:\recomp.sql
HOST DEL C:\RECOMP.SQL
SPOOL OFF
SET ECHO OFF FEED OFF HEAD OFF VERIFY OFF TERMOUT ON
SPOOL C:\RECOMP.SQL
SELECT 'SHOW ERROR ' ||OBJECT_TYPE || ' ' || OWNER || '.' || OBJECT_NAME || ';' || CHR(10)||'PROMPT' INVALIDOS
FROM DBA_OBJECTS
WHERE STATUS = 'INVALID'
AND OWNER = UPPER( '&&1.' )
/
SPOOL OFF
SET ECHO OFF FEED 6 HEAD ON
SPOOL C:\SHOWERROR.LOG
@c:\recomp.sql
HOST DEL C:\RECOMP.SQL
SPOOL OFF
SELECT object_name, object_type, owner
FROM dba_objects
WHERE status = 'INVALID'
AND OWNER = UPPER( '&&1.' )
/
SET VERIFY ON