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;
--执行脚本
@tmp.sql
最后请注意登录ORACLO的权限
本文转自zylhsy 51CTO博客,原文链接:http://blog.51cto.com/yunlongzheng/449268,如需转载请自行联系原作者