OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.1
    iconOceanBase Database
    SQL - V 4.3.1
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Manage directory objects

    Last Updated:2026-04-15 08:25:15  Updated
    Share
    What is on this page
    Create a directory object
    Considerations
    Syntax and examples
    Drop a directory object
    Considerations
    Syntax and examples
    Directory object-related views

    folded

    Share

    The Oracle mode of OceanBase Database allows you to map a folder on a shared file system, such as Network File System (NFS), to a database directory object. Directory objects are mainly used in the UTL_FILE system package.

    Create a directory object

    You can execute the CREATE DIRECTORY statement to create a directory object in OceanBase Database. A created directory object specifies an alias for a folder on the shared file system.

    Considerations

    Take note of the following rules when you create a directory object:

    • OceanBase Database does not automatically create folders in the specified file system path, such as /usr/sqldump. You must manually create folders. For example, you can run the mkdir command to create a folder.

    • OceanBase Database does not check or determine whether the specified file system path exists or whether read/write permissions on this path are obtained.

    • As OceanBase Database is a distributed database system, you must make sure that all OBServer nodes can access the same absolute path. In general, you can specify a path on a shared file system, such as NFS, as the file system path in the statement that is used to create a directory object.

    • You have the CREATE ANY DIRECTORY privilege.

    • When you create a directory object, you must use the global variable secure_file_priv to specify the system path to the files to be accessed.

      The global variable secure_file_priv specifies the path that can be accessed during data import or export. For more information about secure_file_priv, see secure_file_priv.

      You can set the variable by using the following method:

      1. Log on as the administrator to an Oracle tenant in the cluster by using a local Unix socket on the OBServer node.

        Here is an example:

        obclient -S /home/admin/oceanbase/run/sql.sock -uroot@sys -p********
        

        For more information about how to connect to OceanBase Database by using a local Unix socket, see secure_file_priv.

      2. Set the accessible file system path to /usr/sqldump.

        SET GLOBAL secure_file_priv = "/usr/sqldump";
        

      After the statement is executed, you must restart the session for the modification to take effect.

    Syntax and examples

    The syntax for creating a directory object is as follows:

    CREATE [OR REPLACE] DIRECTORY <directory object name> AS <file system path>;
    

    In the syntax, OR REPLACE indicates that if the corresponding directory object already exists, the original directory object definition is replaced with the new file system path.

    Example: Create a directory object named sql_file_dir:

    CREATE OR REPLACE DIRECTORY sql_file_dir AS '/usr/sqldump';
    

    Drop a directory object

    You can execute the DROP DIRECTORY statement to drop a directory object from OceanBase Database. To drop a directory object, ensure that you have the DROP ANY DIRECTORY privilege.

    Considerations

    Take note of the following rules when you drop a directory object:

    • If a directory object is dropped, the folder that the directory object maps to on the shared file system is not dropped.

    • To drop a directory object, you must have the DROP ANY DIRECTORY system privilege.

    • Do not drop a directory object when PL is accessing files in the shared file system.

    Syntax and examples

    The syntax for dropping a directory object is as follows:

    DROP DIRECTORY <Directory object name>;
    

    Example: Drop the directory object named sql_file_dir:

    DROP DIRECTORY sql_file_dir;
    

    Directory object-related views

    After a directory object is created, you can check the status of the directory object based on the following views:

    • DBA_DIRECTORIES

      The DBA_DIRECTORIES view displays the definitions of all directory objects under a tenant. Only the sys user and users that have query permissions on this view can access this view.

      Field
      Type
      Description
      OWNER VARCHAR2(128) The owner of the directory.
      DIRECTORY_NAME VARCHAR2(128) The name of the directory.
      DIRECTORY_PATH VARCHAR2(4000) The path of the directory.
      ORIGIN_CON_ID NUMBER(38) The ID of the tenant.
    • ALL_DIRECTORIES

      The ALL_DIRECTORIES view displays the definitions of the directory objects that are accessible to the current user.

      Field
      Type
      Description
      OWNER VARCHAR2(128) The owner of the directory.
      DIRECTORY_NAME VARCHAR2(128) The name of the directory.
      DIRECTORY_PATH VARCHAR2(4000) The path of the directory.
      ORIGIN_CON_ID NUMBER(38) The ID of the tenant.

    Previous topic

    Query trigger information
    Last

    Next topic

    Create a DBLink
    Next
    What is on this page
    Create a directory object
    Considerations
    Syntax and examples
    Drop a directory object
    Considerations
    Syntax and examples
    Directory object-related views