SET feedback OFF
SET heading OFF
SET linesize 1000
SET pagesize 0
SET pause OFF
SET trimspool ON
SET verify OFF
spool tmp.sql;
--组装SQL语句
SELECT 'alter '||object_type||' '||owner||'.'||object_name||' compile;'
FROM all_objects
WHERE status = 'INVALID'
AND object_type in
('FUNCTION','JAVA SOURCE','JAVA CLASS','PROCEDURE','PACKAGE','VIEW','TRIGGER');
--组装SQL语句
SELECT 'alter package '||owner||'.'||object_name||' compile body;'
FROM all_objects
WHERE status = 'INVALID'
AND object_type = 'PACKAGE BODY';
spool OFF;
最后请注意登录ORACLO的权限