ORA-04065和ORA-06508的一个bug

环境为:HP-UX ORACLE 10.2.0.3 RAC,系统在使用过程中反复出现类似如下错误:

Errors in file /opt/oracle/product/admin/orcl/udump/orcl1_ora_15627.trc:
ORA-12012: error on auto execute of job 61
ORA-04065: not executed, altered or dropped
ORA-04065: not executed, altered or dropped stored procedure "ZLHIS.ZL1_AUTOCPTONE"
ORA-06508: PL/SQL: could not find program unit being called: "ZLHIS.ZL1_AUTOCPTONE"
ORA-06512: at "ZLHIS.ZL1_AUTOCPTALL", line 27
ORA-06512: at line 1

将共享池flush或重新编译相关过程后,又可以使用一段时间;且相关指向procedure的同义词都是无效状态。经查询metalink是Oracle的一个bug,bug编号605008:

Applies to:
Oracle Server - Enterprise Edition - Version: 10.2.0.3
This problem can occur on any platform.

Symptoms
When loading certain PL/SQL packages the database continuously reports ORA-04068 errors.
Restarting database does not help. Flushing shared pool does not help.

We can see timestamp discrepancies exist for valid objects.

打了patch后,使用

1. 用sys登录数据库

2. 执行下列脚本,重新编译相关同义词


declare
cursor cur_syn is select do.name d_name, u.name owner
from sys.obj$ do, sys.dependency$ d, sys.obj$ po, user$ u
where P_OBJ#=po.obj#(+)
and D_OBJ#=do.obj#
and do.status=1 /*dependent is valid*/
and po.status=1 /*parent is valid*/
and po.stime!=p_timestamp /*parent timestamp not match*/
and do.owner#=u.user#
and do.type# = 5
order by 2,1;
v_syn_name obj$.name%TYPE;
v_tab_own user$.name%TYPE;
begin
OPEN cur_syn;
loop
FETCH cur_syn INTO v_syn_name,v_tab_own;
exit when cur_syn%notfound;
if v_tab_own = 'PUBLIC' then
execute immediate 'alter public synonym '||v_syn_name|| ' compile';
else
execute immediate 'alter synonym '||v_tab_own||'.'||v_syn_name|| ' compile';
end if;
end loop;
CLOSE cur_syn;
end;
/

3. 检查编译后的情况:


set pagesize 10000
set linesize 140
column d_name format a20
column p_name format a20
select do.obj# d_obj,do.name d_name, u.name owner, po.obj# p_obj,po.name p_name,
to_char(p_timestamp,'DD-MON-YYYY HH24:MI:SS') "P_Timestamp",
to_char(po.stime ,'DD-MON-YYYY HH24:MI:SS') "STIME",
decode(sign(po.stime-p_timestamp),0,'SAME','*DIFFER*') X
from sys.obj$ do, sys.dependency$ d, sys.obj$ po, user$ u
where P_OBJ#=po.obj#(+)
and D_OBJ#=do.obj#
and do.status=1 /*dependent is valid*/
and po.status=1 /*parent is valid*/
and po.stime!=p_timestamp /*parent timestamp not match*/
and do.owner#=u.user#
and do.type# = 5
order by 2,1;

你可能感兴趣的:(oracle,职场,bug,休闲,4068)