OceanBase logo

OceanBase

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

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

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

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

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    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.3
    iconOceanBase Database
    SQL - V 4.3.3
    SQL
    KV
    • 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 TABLESPACE

    Last Updated:2025-11-27 02:38:06  Updated
    share
    What is on this page
    Purpose
    Syntax
    Parameters
    tablespace_encryption_option
    Examples
    References

    folded

    share

    Purpose

    You can use this statement to create a tablespace logical object. The tablespace attributes can be encrypted.

    Syntax

    • Create an encrypted tablespace.

      CREATE TABLESPACE tablespace_name [ENCRYPTION [=] 'tablespace_encryption_option'];
      
      tablespace_encryption_option:
          N
          | Y
          | AES-256
          | AES-256-GCM
          | AES-128
          | AES-128-GCM
          | AES-192
          | AES-192-GCM
          | SM4-CBC
          | SM4-GCM
      
    • Create a tablespace.

        CREATE TABLESPACE tablespace_name
        [ADD DATAFILE 'file_name']
        [FILE_BLOCK_SIZE = value]
        USE LOGFILE GROUP logfile_group
        [EXTENT_SIZE [=] extent_size]
        [INITIAL_SIZE [=] initial_size]
        [AUTOEXTEND_SIZE [=] autoextend_size]
        [MAX_SIZE [=] max_size]
        [NODEGROUP [=] nodegroup_id]
        [WAIT]
        [COMMENT [=] 'string']
        [ENGINE [=] engine_name]
      

      Notice

      Only the keyword syntax is supported. The functionality does not actually take effect. You cannot use this keyword in combination with ENCRYPTION. Otherwise, a syntax error will be returned.

    Parameters

    Parameter Description
    tablespace_name The name of the tablespace to be created.
    ENCRYPTION Optional. The keyword used for specifying the encryption algorithm employed by the tablespace. If the encryption algorithm is not specified through the ENCRYPTION keyword, a non-encrypted tablespace is created by default. For a detailed introduction to the encryption algorithms, see tablespace_encryption_option.

    tablespace_encryption_option

    • N: specifies not to enable encryption for the tablespace.
    • Y: If Y is specified, the AES-256 encryption algorithm is used by default.
    • AES-256: uses a 256-bit key for encryption and decryption.
    • AES-256-GCM: uses Galois/Counter Mode (GCM) with a 256-bit key.
    • AES-128: uses a 128-bit key for encryption and decryption.
    • AES-128-GCM: uses GCM with a 128-bit key.
    • AES-192: uses a 192-bit key for encryption and decryption.
    • AES-192-GCM: uses GCM with a 192-bit key.
    • SM4-CBC: uses the SM4 algorithm in Cipher Block Chaining (CBC) mode, where before each block of data is encrypted, it undergoes an XOR operation with the encrypted output of the previous block.
    • SM4-GCM: uses the SM4 algorithm in GCM mode, which provides both encryption and authentication functionalities.

    Note

    • Advanced Encryption Standard (AES) is a symmetric encryption algorithm, meaning the same key is used for both data encryption and decryption. The AES algorithm is block-based, typically encrypting data in 128-bit blocks.
    • AES-GCM is an operational mode employed for block encryption algorithms, such as AES, providing both encryption and data authentication (also known as message authentication code).
    • The block size of the SM4 algorithm is 128 bits, and the key length is also 128 bits.

    Examples

    • Create an unencrypted tablespace object.

      CREATE TABLESPACE tablespace001;
      
    • Create a tablespace object with transparent data encryption (TDE).

      1. Set the encryption method to built-in transparent encryption.

        ALTER SYSTEM SET tde_method = 'internal';
        
      2. Display the current configuration of the encryption method.

        SHOW PARAMETERS LIKE 'tde_method';
        
      3. Generate a new master encryption key.

        ALTER INSTANCE ROTATE INNODB MASTER KEY;
        

        Notice

        Although this command can be executed, if the disk space is full, a new master encryption key will not be generated.

      4. Create an encrypted tablespace named tablespace2 that uses the SM4-GCM encryption algorithm.

        CREATE TABLESPACE tablespace002 ENCRYPTION = 'SM4-GCM';
        

    References

    • tde_method
    • Enable TDE for new tables

    Previous topic

    CREATE TABLEGROUP
    Last

    Next topic

    CREATE USER
    Next
    What is on this page
    Purpose
    Syntax
    Parameters
    tablespace_encryption_option
    Examples
    References