标签:oracle;
每次数据库升级之后,都需要对库中的对象进行重新编译一下。下面整理出了一个脚本,只需要执行一下就能批量编译这些失效的对象。需要注意的是:因权限问题,最好是选择sys用户来执行这个脚本,如是plsql developer中执行,记得选择“ALL USERS”
[oracle@oracle ~]$ cat check_compile.sql set heading off; set feedback off; set echo off; Set lines 999; Spool run_invalid.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 ‘||‘;‘ from dba_objects where status like ‘INV%‘; spool off; set heading on; set feedback on; set echo on; @run_invalid.sql
本文出自 “清淼淡写” 博客,请务必保留此出处http://qingmiao.blog.51cto.com/7286083/1983274
标签:oracle;
原文地址:http://qingmiao.blog.51cto.com/7286083/1983274