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

版权声明:本文为博主原创文章。未经博主同意不得转载。 https://blog.csdn.net/q947817003/article/details/24419459

客户遇到个问题,描写叙述例如以下:--环境是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 <object name>
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.

原文地址:https://www.cnblogs.com/ldxsuanfa/p/10016772.html