通过存储过程执行通过DBLINK的查询语句失败-单个语句成功--ORA-00604

客户遇到个问题,描述如下:--环境是ORACLE 9.2.0.8

(语句及场景非真实了,网上找的,情况是一致的)
创建了一个DB_LINK连接另一个Oracle数据库。 select * from tablename@dblinkname;

单句执行没问题,但是把这句SQL写到存储过程内:

create or replace procedure prc_test
is
begin
insert into test
select * from tablename@dblinkname;
commit;
end;
就发生如下错误,存储过程编译不通过:

Compilation errors for PROCEDURE prc_test

Error: PL/SQL: ORA-04052: 在查找远程对象 tablename@dblinkname 时出错
       ORA-00604: 递归 SQL 层 1 出现错误
       ORA-03106: 致命的双工通信协议错误
       ORA-02063: 紧接着line(源于XXX(被连接的数据库服务名))
Line: 4
Text: insert into test

Error: PL/SQL: SQL Statement ignored
Line: 4
Text: insert into test
#########################################################

以下metalink上解决问题方法,打上对应的补丁即可

--这里我未打补丁,只是找出原因向客户说明而已。


Subject:  Errors ORA-00604 And ORA-03106 During Procedure Compilation
  Doc ID:  577347.1 Type:  PROBLEM
  Modified Date :  26-MAY-2008 Status:  MODERATED


Applies to:
PL/SQL - Version: 9.2.0.4 to 9.2.0.8
This problem can occur on any platform.
This note applies only if the underlying Oracle Client is below 9.2.0.8 Patch 4


Symptoms
While trying to run pl/sql code involving queries which access remote objects, you may endup getting below errors:

PL/SQL: ORA-04052: error occurred when looking up remote object
ORA-00604: error occurred at recursive SQL level 1
ORA-03106: fatal two-task communication proto error
ORA-02063: preceding line from AFQ

When the same query is run outside pl/sql block it runs perfectly.

Cause
You are most probably hitting the Bug 5866805.
Bug 5866805 duplicate of Bug 5576340 which is itself a duplicate of Bug 5671074.


Solution
The Bug 5671074 IS fixed IN 9.2 .0 .8 Patch 4 OR above.

你可能感兴趣的:(ORACLE,故障排查)