首批通过分布式安全可靠测评,为关键业务系统打造
使用 DBLink 访问 LOB 类型时遇到报错:-4007, Not supported feature or function 的原因和解决方法
更新时间:2026-06-03 03:01
问题现象
通过 OceanBase 数据库中的 DBLink 去访问大数据 LOB 类型时会遇到报错:ORA-00600: internal error code, arguments: -4007, Not supported feature or function。
具体示例如下。
通过
SYS用户登录Oracle租户。[root@obxx ~]# obclient -h127.0.0.1 -usys@oracle -P2881 -pxxx -A -c Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221722230 Server version: OceanBase 4.2.1.6 (r106000022024042414-e43efbffdcc50956239225104e944068375568b6) (Built Apr 24 2024 15:07:44) Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.创建连接到远端 OceanBase 数据库的
DBLink,名称为ob_dblink1。远端数据库的租户为perforacle。obclient [SYS]> CREATE DATABASE LINK ob_dblink1 CONNECT TO sys@perforacle IDENTIFIED BY xxx OB HOST '192.xxx.xxx.58:2881'; Query OK, 1 row affected (0.056 sec)在
SYS用户下,创建表test_lob。obclient [SYS]> create table test_lob (id int, name clob); Query OK, 0 rows affected (0.155 sec)退出
SYS用户登录的Oracle租户。obclient [SYS]> Bye通过
SYS用户登录远端数据库的perforacle租户。[root@obxx ~]# obclient -h127.0.0.1 -usys@perforacle -P2881 -pxxx -A -c Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221492652 Server version: OceanBase 4.2.1.6 (r106000022024042414-e43efbffdcc50956239225104e944068375568b6) (Built Apr 24 2024 15:07:44) Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.在远端数据库的
perforacle租户中SYS用户下,创建表test_lob。obclient [SYS]> create table test_lob (id int, name clob); Query OK, 0 rows affected (0.194 sec)在远端数据库的
perforacle租户中SYS用户下,向表test_lob插入数据。obclient [SYS]> insert into test_lob values (1,'aaaaaa'),(2,'bbbbbb'),(3,'cccccc'); Query OK, 3 rows affected (0.027 sec) Records: 3 Duplicates: 0 Warnings: 0在远端数据库的
perforacle租户中SYS用户下,提交数据。obclient [SYS]> commit; Query OK, 0 rows affected (0.001 sec)在远端数据库的
perforacle租户中SYS用户下,查询表test_lob。obclient [SYS]> select * from test_lob;输出结果如下:
+------+--------+ | ID | NAME | +------+--------+ | 1 | aaaaaa | | 2 | bbbbbb | | 3 | cccccc | +------+--------+ 3 rows in set (0.060 sec)退出远端数据库的
perforacle租户下的SYS用户。obclient [SYS]> Bye通过
SYS用户登录Oracle租户。[root@obxx ~]# obclient -h127.0.0.1 -usys@oracle -P2881 -pxxx -A -c Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221730163 Server version: OceanBase 4.2.1.6 (r106000022024042414-e43efbffdcc50956239225104e944068375568b6) (Built Apr 24 2024 15:07:44) Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.在
SYS用户下,查询表test_lob。obclient [SYS]> select * from test_lob; Empty set (0.009 sec)通过远端数据库名为
ob_dblink1的DBLink访问查询表test_lob。obclient [SYS]> select * from test_lob@ob_dblink1; ORA-00600: internal error code, arguments: -4007, Not supported feature or function通过远端数据库名为
ob_dblink1的DBLink访问查询表test_lob的id列。obclient [SYS]> select id from test_lob@ob_dblink1;输出结果如下:
+------+ | ID | +------+ | 1 | | 2 | | 3 | +------+ 3 rows in set (0.015 sec)通过远端数据库名为
ob_dblink1的DBLink访问查询表test_lob的行数。obclient [SYS]> select count(*) from test_lob@ob_dblink1;输出结果如下:
+----------+ | COUNT(*) | +----------+ | 3 | +----------+ 1 row in set (0.012 sec)obclient [SYS]> select count(1) from test_lob@ob_dblink1;输出结果如下:
+----------+ | COUNT(1) | +----------+ | 3 | +----------+ 1 row in set (0.011 sec)obclient [SYS]> select count(id) from test_lob@ob_dblink1;输出结果如下:
+-----------+ | COUNT(ID) | +-----------+ | 3 | +-----------+ 1 row in set (0.009 sec)obclient [SYS]> select count(name) from test_lob@ob_dblink1; ORA-00932: inconsistent datatypes通过远端数据库名为
ob_dblink1的DBLink将远端数据库的perforacle租户中SYS用户下的表test_lob数据插入到Oracle租户中SYS用户下的表test_lob中。obclient [SYS]> insert into test_lob select * from test_lob@ob_dblink1; ORA-00600: internal error code, arguments: -4007, Not supported feature or function
问题原因
该问题属于已知的功能限制:目前 OceanBase 数据库各个版本的 Oracle 模式都还不支持通过 DBLink 读取 LOB 字段,而 MySQL 模式从 OceanBase 数据库 V4.2 版本开始支持通过 DBLink 读取 LOB 字段。 目前通过 DBlink 去访问 原生 Oracle 或者 OceanBase 数据库 Oracle 模式时,下面这些数据类型都是不支持的,会遇到报错:ORA-00600: internal error code, arguments: -4007, Not supported feature or function。
三种文本字符串:clob、nclob、long。
三种二进制字符串:blob、bfile、long raw。
伪列:rowid、urowid。
PL 数据类型如嵌套表、xmltype、varray 等。
说明
- OceanBase 数据库 Oracle 模式支持的大对象 LOB 类型有:
clob、blob、json,暂不支持text、geometry类型 - OceanBase 数据库 MySQL 模式支持的大对象 LOB 类型有:
text(分为tinytext、text、mediumtext、longtext)、blob(分为tinyblob、blob、mediumblob、longblob)、json、geometry,暂不支持clob类型
问题的风险及影响
通过 DBLink 读写大 LOB 字段的表数据失败。
影响租户
影响 OceanBase 数据库中的 SYS 租户和 MySQL 租户无影响,对于 Oracle 租户有影响。
适用版本
OceanBase 数据库 V3.2.3(oceanbase-3.2.3.0-20220418212020) 及之后的版本。
解决方法
避免通过 DBLink 来直接访问 OceanBase 数据库 Oracle 模式或原生 Oracle 的上述数据类型。