1. 程式人生 > >通過儲存過程執行通過DBLINK的查詢語句失敗-單個語句成功--ORA-00604

通過儲存過程執行通過DBLINK的查詢語句失敗-單個語句成功--ORA-00604

客戶遇到個問題,描寫敘述例如以下:--環境是ORACLE 9.2.0.8

(語句及場景非真實了。網上找的。情況是一致的)
建立了一個DB_LINK連線還有一個Oracle資料庫。 select * from [email protected];

單句執行沒問題,可是把這句SQL寫到儲存過程內:

create or replace procedure prc_test
is
begin
insert into test
select * from [email protected];
commit;
end;
就發生例如以下錯誤,儲存過程編譯不通過:

Compilation errors for PROCEDURE prc_test

Error: PL/SQL: ORA-04052: 在查詢遠端物件
[email protected]
時出錯
       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.