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

    Modify the SHARDING attribute of a table group

    Last Updated:2026-04-15 08:25:14  Updated
    share
    What is on this page
    Limitations
    Rules
    Modify the table group attribute
    References

    folded

    share

    After you create a table group, you can modify the SHARDING attribute of the table group based on your business adjustments.

    Limitations

    Do not execute the ALTER TABLEGROUP statement to modify the SHARDING attribute during the upgrade of OceanBase Database.

    Rules

    Before you modify the SHARDING attribute of a table group, check whether the table group contains tables and the partition information of the tables. For more information, see View table group information.

    If the table group does not contain tables, you can modify the SHARDING attribute of the table group as needed. If the table group contains tables, the modification is subject to the following rules:

    • If you want to change the SHARDING attribute of the table group to NONE, you can do so without considering the partition definitions of the tables in the table group.

    • If you want to change the SHARDING attribute of the table group to PARTITION, the partitioned tables must meet the following requirements:

      • If all tables in the table group are non-partitioned tables, the modification is allowed.

      • If the table group contains both partitioned and non-partitioned tables, the modification is not allowed.

      • If the table group contains only partitioned tables, the partition types, number of partitions, and partition values of all tables must be the same.

    • If you want to change the SHARDING attribute of the table group to ADAPTIVE, the partitioned tables must meet the following requirements:

      • If all tables in the table group are non-partitioned tables, the modification is allowed.

      • If the table group contains both partitioned and non-partitioned tables, the modification is not allowed.

      • If the table group contains both partitioned tables and subpartitioned tables, the modification is not allowed.

      • If all tables in the table group are partitioned tables, the partition types, number of partitions, and partition values of all tables must be the same.

      • If all tables in the table group are subpartitioned tables, the partition types, number of partitions, and partition values of all partitioned tables and subpartitioned tables must be the same.

    Modify the table group attribute

    Execute the following statement to modify the SHARDING attribute of a table group:

    ALTER TABLEGROUP tablegroup_name tablegroup_option;
    
    tablegroup_option:
    SHARDING = 'NONE'
    SHARDING = 'PARTITION'
    SHARDING = 'ADAPTIVE'
    

    The statement parameters are described as follows:

    • Make sure that you have the global ALTER privilege before you execute the statement.

    • tablegroup_name: the name of the table group whose attribute is to be modified.

    • SHARDING: the table group attribute. The modification is subject to the preceding rules.

    Here is an example of modifying the table group attribute:

    1. Create a table group named tblgroup1 with the SHARDING attribute set to PARTITION.

      CREATE TABLEGROUP tblgroup1 SHARDING = 'PARTITION'; 
      
    2. Create two partitioned tables named tbl1 and tbl2 with the same partition definition, and add them to the tblgroup1 table group.

      CREATE TABLE tbl1 (col1 BIGINT PRIMARY KEY,col2 VARCHAR(50)) TABLEGROUP = tblgroup1
      PARTITION BY LIST(col1)
      (PARTITION p0 VALUES IN (1, 2, 3),
      PARTITION p1 VALUES IN (5, 6),
      PARTITION p2 VALUES IN (DEFAULT)
      );
      
      CREATE TABLE tbl2 (col1 BIGINT PRIMARY KEY,col2 VARCHAR(50)) TABLEGROUP = tblgroup1
      PARTITION BY LIST(col1)
      (PARTITION p0 VALUES IN (1, 2, 3),
      PARTITION p1 VALUES IN (5, 6),
      PARTITION p2 VALUES IN (DEFAULT)
      );
      
    3. Change the SHARDING attribute of the tblgroup1 table group to ADAPTIVE.

      ALTER TABLEGROUP tblgroup1 SHARDING = "ADAPTIVE";
      
    4. View the table group attribute.

      SHOW TABLEGROUPS WHERE tablegroup_name = 'tblgroup1';
      

      The result is as follows:

      +-----------------+------------+---------------+----------+
      | Tablegroup_name | Table_name | Database_name | Sharding |
      +-----------------+------------+---------------+----------+
      | tblgroup1       | tbl1       | test          | ADAPTIVE |
      | tblgroup1       | tbl2       | test          | ADAPTIVE |
      +-----------------+------------+---------------+----------+
      2 rows in set
      

      The tbl1 and tbl2 tables in the table group are all partitioned tables, and their partition types, number of partitions, and partition values are the same, which meets the modification requirements.

    References

    • Overview of table groups

    • Create a table group

    • Query information about a table group

    • Add tables to a table group

    • Manage tables in a table group

    • Drop a table group

    Previous topic

    Add tables to a table group
    Last

    Next topic

    Manage tables in a table group
    Next
    What is on this page
    Limitations
    Rules
    Modify the table group attribute
    References