oracle编译表上失效USERDBY脚本
对表进行DLL操作之后,依赖这个表的一些存储过程,触发器等会失效,可以用下边的脚本进行重编译
/* Formatted on 2020/7/8 上午 09:31:31 (QP5 v5.163.1008.3004) */ SELECT DISTINCT 'Alter ' || CASE WHEN object_type = 'PACKAGE BODY' THEN 'PACKAGE' ELSE object_type END || ' ' || owner || '.' || object_name || ' compile;' FROM dba_objects WHERE (owner, object_name) IN ( SELECT owner, name FROM dba_dependencies START WITH referenced_owner = 'XXXXX' AND referenced_name = 'XXXXX' AND TYPE IN ('FUNCTION', 'PACKAGES', 'PACKAGE BODY', NULL, 'PROCEDURE', 'SYNONYM') CONNECT BY NOCYCLE PRIOR owner = referenced_owner AND PRIOR name = referenced_name);
以上代码需要多执行几次,防止因依赖的存储过程后编译而导致前面的存储过程没有被编译通过。