每次数据库升级之后,都需要对库中的对象进行重新编译一下。下面整理出了一个脚本,只需要执行一下就能批量编译这些失效的对象。需要注意的是:因权限问题,最好是选择sys用户来执行这个脚本,如是plsql developer中执行,记得选择“ALL USERS”
[[email protected] ~]$ 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
时间: 2024-10-11 11:45:23