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.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.3.0
    iconOceanBase Database
    SQL - V 4.3.0
    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:30:01  Updated
    share
    What is on this page
    Limitations
    Modification rules
    Modify the SHARDING attribute
    References

    folded

    share

    After you create a table group, you can modify its SHARDING attribute based on business needs.

    Limitations

    During the upgrade of OceanBase Database, it is prohibited to use the ALTER TABLEGROUP statement to modify the SHARDING attribute of a table group.

    Modification rules

    Before you modify the SHARDING attribute of a table group, check whether the table group contains tables. If yes, view the partition information of the tables. For more information about how to view tables in a table group, see Query information about a table group.

    If the table group does not contain tables, you can modify the SHARDING attribute as needed. If the table group contains tables, modify the SHARDING attribute of the table group based on the following rules:

    • You can directly change the value of the SHARDING attribute to NONE without considering the partition definition of tables in the table group.

    • When you change the value of the SHARDING attribute to PARTITION, note that:

      • If the table group contains only non-partitioned tables, you can directly change the attribute value.

      • If the table group contains both non-partitioned and partitioned tables, you cannot modify the attribute.

      • If the table group contains only partitioned or subpartitioned tables, make sure that all tables in the table group have the same partitioning type, partition count, and partition value. Otherwise, you cannot modify the attribute.

    • When you change the value of the SHARDING attribute to ADAPTIVE, note that:

      • If the table group contains only non-partitioned tables, you can directly change the attribute value.

      • If the table group contains both non-partitioned and partitioned tables, you cannot modify the attribute.

      • If the table group contains both partitioned and subpartitioned tables, you cannot modify the attribute.

      • If the table group contains only partitioned tables, all the tables must have the same partitioning type, partition count, and partition value. Otherwise, you cannot modify the attribute.

      • If all tables in the table group are subpartitioned tables, make sure that all partitioned tables and subpartitioned tables correspond to the same partition type, number of partitions, and partition values.

    Modify the SHARDING attribute

    The SQL syntax for modifying the SHARDING attribute of a table group is as follows:

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

    where

    • tablegroup_name specifies the name of the table group to be modified.

    • SHARDING specifies the SHARDING attribute of the table group. You must follow specific rules when you modify the SHARDING attribute of the table group.

    Here is an example:

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

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

      CREATE TABLE tbl1(col1 NUMBER,col2 VARCHAR2(50)) TABLEGROUP = tblgroup1
      PARTITION BY LIST(col1)
      (PARTITION p0 VALUES('01'),
      PARTITION p1 VALUES('02')
      );
      
      CREATE TABLE tbl2(col1 NUMBER,col2 VARCHAR2(50)) TABLEGROUP = tblgroup1
      PARTITION BY LIST(col1)
      (PARTITION p0 VALUES('01'),
      PARTITION p1 VALUES('02')
      );
      
    3. Change the SHARDING attribute value of the table group tblgroup1 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       | SYS           | ADAPTIVE |
      | TBLGROUP1       | TBL2       | SYS           | ADAPTIVE |
      +-----------------+------------+---------------+----------+
      2 rows in set
      

      The TBL1 and TBL2 tables in the table group are all partitioned tables and have the same partitioning type, partition count, and partition value. Therefore, the SHARDING attribute is successfully modified.

    References

    • 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
    Modification rules
    Modify the SHARDING attribute
    References