11.2通过数据库链调用10.2过程报错

测试中无意发现了这个bug,在11.2数据库通过数据库链,执行10.2.0.1上的过程,结果出现ORA-06553: PLS-801: internal error [55916]的错误。
错误可以通过下面的例子重现:

-bash-3.2$ sqlplus / AS sysdba
SQL*Plus: Release 10.2.0.1.0 - Production ON Mon Sep 12 23:12:47 2011
Copyright (c) 1982, 2005, Oracle.  ALL rights reserved.
Connected TO:
Oracle DATABASE 10g Express Edition Release 10.2.0.1.0 – Production
SQL> CREATE USER test IDENTIFIED BY test DEFAULT tablespace users;
USER created.
SQL> SHOW parameter service
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      XE
SQL> GRANT CONNECT, resource, dba TO test;
GRANT succeeded.
SQL> conn test/test
Connected.
SQL> CREATE PROCEDURE p1 AS
  2  BEGIN
  3  NULL;
  4  END;
  5  /
PROCEDURE created.

首先在10.2.0.1环境中创建一个存储过程。

SQL> CREATE DATABASE link xe CONNECT TO test IDENTIFIED BY test USING '192.168.0.20:1522/XE';
DATABASE link created.
SQL> EXEC p1@xe
BEGIN p1@xe; END;
*
ERROR at line 1:
ORA-04052: error occurred WHEN looking up remote object TEST.P1@XE
ORA-00604: error occurred at recursive SQL level 1
ORA-06544: PL/SQL: internal error, arguments: [55916], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [55916]
ORA-02063: preceding 2 LINES FROM XE
SQL> SELECT * FROM dual@xe;
D
-
X
SQL> SELECT * FROM v$version;
BANNER
--------------------------------------------------------------------------------
Oracle DATABASE 11g Enterprise Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS FOR Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 – Production
SQL> SELECT * FROM v$version@xe;
BANNER
----------------------------------------------------------------
Oracle DATABASE 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS FOR Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

在11.2中调用这个存储过程报错,尝试使用同义词或动态SQL,都无法绕过这个错误:

SQL> CREATE synonym s1 FOR p1@xe;
Synonym created.
SQL> EXEC s1
BEGIN s1; END;
*
ERROR at line 1:
ORA-04052: error occurred WHEN looking up remote object TEST.P1@XE
ORA-00604: error occurred at recursive SQL level 1
ORA-06544: PL/SQL: internal error, arguments: [55916], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [55916]
ORA-02063: preceding 2 LINES FROM XE
SQL> BEGIN
  2  EXECUTE immediate 'begin p1@xe; end;';
  3  END;
  4  /
BEGIN
*
ERROR at line 1:
ORA-04052: error occurred WHEN looking up remote object TEST.P1@XE
ORA-00604: error occurred at recursive SQL level 2
ORA-06544: PL/SQL: internal error, arguments: [55916], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [55916]
ORA-02063: preceding 2 LINES FROM XE
ORA-06512: at line 2

在metalink文档Bug 4511371中描述了这个问题:ORA-6544 / ORA-4052 using PLSQL between 10g and 11g。根据文档描述,在10.2.0.1中通过数据库链访问11.2的过程也会出现同样的错误,而解决方法除了升级到10.2.0.2及以上版本外,没有其他的解决方法。

This entry was posted in BUG and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *