---
title: 旁路导入时 secure_file_priv 租户变量的设置方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于旁路导入时 secure_file_priv 租户变量的设置方法相关的常见问题和使用技巧，帮助您快速解决旁路导入时 secure_file_priv 租户变量的设置方法的难题。
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# 旁路导入时 secure_file_priv 租户变量的设置方法

更新时间：2026-06-10 01:56

适用版本： V2.2.x、V3.1.x、V3.2.x、V4.0.x、V4.1.x、V4.2.x、V4.3.x 内容类型：TechNote  

本文介绍旁路导入时 `secure_file_priv` 租户变量的设置方法。

## 问题现象

当使用旁路导入进行数据导入时，通常需要先设置好导入的文件路径，即 `secure_file_priv` 租户变量。如果通过常用的直连 2881 或 OBProxy 2883 端口连接到对应租户并设置 `secure_file_priv` 会遇到报错。

```shell
[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)

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 及以后版本。

```shell
[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)

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](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000001576585)。

上一篇

[OceanBase 数据库 V4.x 版本中修改租户的 primary_zone 报错 4019，Size overflow 的原因和解决方法](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000002398335)

下一篇

[租户 table history 过多导致重启时 schema 刷新报错 -4013 的原因及解决方法](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000002762861) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
