批量编译无效对象

时间:2017-11-10 14:18:31   收藏:0   阅读:265

sqlplus "/as sysdba"
@$ORACLE_HOME\RDBMS\ADMIN\utlrp.sql; this script will compile all invalid objects in database

 

自己编写的一个脚本

$ more check.sql
set head off
set pagesize 2000
spool comp.sql
select ‘alter ‘||decode(object_type, ‘VIEW‘, ‘VIEW‘,‘TRIGGER‘,‘TRIGGER‘,
       ‘PROCEDURE‘, ‘PROCEDURE‘, ‘FOUNCTION‘,‘FUNCTION‘,
       ‘PACKAGE‘,‘PACKAGE‘, ‘PACKAGE BODY‘, ‘PACKAGE‘, ‘MATERIALIZED VIEW‘) 
       ||‘ ‘||owner||‘.‘||object_name||‘ compile ‘||
       decode(object_type, ‘PACKAGE BODY‘, ‘ BODY‘)||‘;‘ 
from dba_objects
where status like ‘INV%‘;   
spool off   


在ORACLE_HOME下创建check.sql
sqlplus / as sysdba
@check.sql

@comp.sql

原文:http://www.cnblogs.com/Clark-cloud-database/p/7814332.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!