测试中无意发现了这个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及以上版本外,没有其他的解决方法。