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.1.0

    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.1.0
    iconOceanBase Database
    SQL - V 4.1.0
    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

    CREATE TENANT

    Last Updated:2023-07-28 02:55:42  Updated
    Share
    What is on this page
    Purpose
    Syntax
    Parameters
    Examples

    folded

    Share

    Purpose

    You can use this statement to create a tenant.

    Note

    To execute this statement, you must log on to the sys tenant as the root user.

    Syntax

    CREATE TENANT [IF NOT EXISTS] tenant_name
         [tenant_characteristic_list] [opt_set_sys_var];
    
    tenant_characteristic_list:
      tenant_characteristic [, tenant_characteristic...]
    
    tenant_characteristic:
          COMMENT 'string'  
        | {CHARACTER SET | CHARSET} [=] charsetname
        | COLLATE [=]  collationname
        | ZONE_LIST [=] (zone [, zone...])
        | PRIMARY_ZONE [=] zone  
        | DEFAULT TABLEGROUP [=] {NULL | tablegroup}
        | RESOURCE_POOL_LIST [=](poolname [, poolname...])
        | LOCALITY [=] 'locality description'
    
    opt_set_sys_var:
      {SET | SET VARIABLES | VARIABLES} system_var_name = expr [,system_var_name = expr] ...
    

    Parameters

    Parameter
    Description
    tenant_name The name of the tenant. The name cannot exceed 128 characters in length. It must contain only uppercase and lowercase letters, digits, and underscores (_). The name must start with a letter or an underscore (_) and must not contain reserved keywords of OceanBase Database.
    IF NOT EXISTS If the tenant name already exists and IF NOT EXISTS is not specified, an error is returned.
    RESOURCE_POOL_LIST The list of resource pools. This parameter is required when you create a tenant.
    DEFAULT TABLEGROUP The default table group of the tenant. When you set it to NULL, the system disables the default table group. If this parameter is not specified, the default value is NULL.
    COMMENT The comment.
    CHARACTER SET | CHARSET The character set.
    COLLATE The collation.
    PRIMARY_ZONE The name of the primary zone of the tenant.
    LOCALITY The distribution of replicas across zones. For example, F@z1,F@z2,F@z3 indicates that z1, z2, and z3 are full-featured replicas.
    system_var_name The system variables of the tenant. ob_compatibility_mode specifies the compatibility mode of the tenant. Valid values: MySQL and Oracle. You can specify the compatibility mode only when you create the tenant. If you do not specify this parameter, the compatibility mode is MySQL by default.

    Examples

    • Create a tenant.

      obclient> CREATE TENANT IF NOT EXISTS tenant1 CHARSET='utf8mb4',PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('pool1') set ob_tcp_invited_nodes='%';
      
    • Create a tenant in Oracle mode.

      obclient> CREATE TENANT IF NOT EXISTS tenant1 ZONE_LIST=('zone1'), PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('pool1') SET ob_compatibility_mode='oracle', set ob_tcp_invited_nodes='%';
      

    Previous topic

    CREATE RESOURCE UNIT
    Last

    Next topic

    DROP RESOURCE POOL
    Next
    What is on this page
    Purpose
    Syntax
    Parameters
    Examples