首批通过分布式安全可靠测评,为关键业务系统打造
旁路导入时 secure_file_priv 租户变量的设置方法
更新时间:2026-06-10 01:56
本文介绍旁路导入时 secure_file_priv 租户变量的设置方法。
问题现象
当使用旁路导入进行数据导入时,通常需要先设置好导入的文件路径,即 secure_file_priv 租户变量。如果通过常用的直连 2881 或 OBProxy 2883 端口连接到对应租户并设置 secure_file_priv 会遇到报错。
[root@observer ~]# obclient -hxxx.xxx.xxx.xxx -P2883 -uSYS@oboracle#kylin_kvm_cluster1 -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 2361312
Server version: OceanBase 3.2.4.8 (r108030012024102211-a93c91b0a83a081a9e5c3ab96250517f17483b5c) (Built Oct 22 2024 11:35:15)
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.
obclient(SYS@oboracle)[SYS]>
obclient(SYS@oboracle)[SYS]> set global secure_file_priv = "/";
ORA-00600: internal error code, arguments: -4007, Not supported feature or function
obclient(SYS@oboracle)[SYS]>
obclient(SYS@oboracle)[SYS]> set global secure_file_priv = '';
ORA-00600: internal error code, arguments: -4007, Not supported feature or function
[root@observer ~]# obclient -hxxx.xxx.xxx.xxx -P2881 -uSYS@oboracle -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221623480
Server version: OceanBase 3.2.4.8 (r108030012024102211-a93c91b0a83a081a9e5c3ab96250517f17483b5c) (Built Oct 22 2024 11:35:15)
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.
obclient(SYS@oboracle)[SYS]> set global secure_file_priv = '';
ORA-00600: internal error code, arguments: -4007, Not supported feature or function
obclient(SYS@oboracle)[SYS]> set global secure_file_priv = "/";
ORA-00600: internal error code, arguments: -4007, Not supported feature or function
影响租户
影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。
适用版本
OceanBase 数据库 V2.2.77(oceanbase-2.2.77-20210508211731)及以后版本。
OBClient V2.2.7 BP1 及以后版本。
解决方法
在部署 OceanBase 数据库的本机上运行如下登录命令且 OBClient 工具需要为 V2.2.7BP1 及以后版本。
[root@observer ~]# obclient -S /home/admin/oceanbase/run/sql.sock -uxxxx@xxx -pxxxxxx
[root@observer ~]# obclient -S /home/admin/oceanbase/run/sql.sock -usys@oboracle -p
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221742871
Server version: OceanBase 4.2.1.9 (r109000092024091919-9e4708744c35a06376fd4289b995cf1ae70698d7) (Built Sep 19 2024 19:55:12)
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.
obclient(SYS@oboracle)[SYS]> set global secure_file_priv = '';
Query OK, 0 rows affected (0.079 sec)
obclient(SYS@oboracle)[SYS]> set global secure_file_priv = "/";
Query OK, 0 rows affected (0.092 sec)
OceanBase 数据库中 secure_file_priv 租户变量情况
OBServer V4.2.0(不含)以下的版本。
空字符串:表示没有限制,任意路径均可以访问。
NULL: 表示没有限制,任意路径均可以访问。
路径名:表示仅该路径下的文件可以被导入或导出。
"NULL":表示导入、导出被禁用。
OBServer V4.2.0(含)及更高的版本。
空字符串:表示导入、导出被禁用。
NULL:表示导入、导出被禁用。
"NULL":表示导入、导出被禁用。
路径名:表示仅该路径下的文件可以被导入或导出。
"/":表示没有限制,任意路径均可访问。
注意
secure_file_priv 租户变量的不同取值在各 OceanBase 数据库版本中语义略有不同,且从 V4.2.1 版本开始默认值由 NULL 调整为 ""。
更多详情可参见:secure_file_priv。