ALTER TENANT

2023-12-25 08:49:41  Updated

Purpose

You can use this statement to modify tenant information.

This statement can be executed only in the sys tenant by the administrator of the sys tenant.

Syntax

ALTER TENANT {tenant_name | ALL}
    [SET] [tenant_option_list] [opt_global_sys_vars_set];

tenant_option_list:
    tenant_option [, tenant_option ...]

tenant_option:
            COMMENT [=]'string'
          | {CHARACTER SET | CHARSET} [=] charset_name
          | COLLATE [=] collation_name
          | ZONE_LIST [=] (zone [, zone...])
          | PRIMARY_ZONE [=] zone
          | RESOURCE_POOL_LIST [=](pool_name [, pool_name...])
          | DEFAULT TABLEGROUP [=] {NULL | tablegroup_name}
          | {READ ONLY | READ WRITE}
          | LOCALITY [=] 'locality_description'
          | RENAME GLOBAL_NAME TO new_tenant_name

opt_global_sys_vars_set:
      VARIABLES system_var_name = expr [,system_var_name = expr] ...

Parameters

Parameter Description
tenant_name The name of the tenant to be modified. ALL indicates to modify all tenants.
RESOURCE_POOL_LIST The list of resource pools.
DEFAULT TABLEGROUP The default table group of the tenant. When you set it to NULL, the system disables the default table group.
COMMENT Modifies the comment.
CHARACTER SET | CHARSET Modifies the character set of the tenant.

Note

The current version does not support this parameter.

COLLATE Modifies the collation of the tenant.

Note

The current version does not support this parameter.

ZONE_LIST The list of zones to be modified.

Note

The current version does not support this parameter.

PRIMARY_ZONE The primary zone of the tenant.
READ ONLY | READ WRITE The read-only or read/write attribute of the tenant.

Note

The current version does not support this parameter.

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 Modifies the system variable value of the tenant.
RENAME GLOBAL_NAME TO Renames the tenant.

Examples

  • Change the primary zone of tenant1 to zone2.

    obclient> ALTER TENANT tenant1 primary_zone='zone2';
    Query OK, 0 rows affected
    
  • Do not directly replace the resource pool of the tenant. Otherwise, the following error occurs.

    obclient> ALTER TENANT tenant1 resource_pool_list=('pool2');
    ERROR 1210 (HY000): Incorrect arguments to resource pool list
    

    If you want to scale out the tenant, you can modify the specifications of the resource unit.

    obclient> ALTER RESOURCE UNIT unit1 MAX_CPU 15, MEMORY_SIZE '20G', MAX_IOPS 1280, MIN_CPU=10, MIN_IOPS=1024;
    Query OK, 0 rows affected
    
  • Modify the locality of tenant1 to increase the number of replicas. F indicates a full-featured replica, and B_4 is the name of the zone to be created.

    obclient> CREATE RESOURCE UNIT unit1, MAX_CPU=5, MIN_CPU=2.5, MEMORY_SIZE= 34359738368, MAX_IOPS=10000, MIN_IOPS=5000, LOG_DISK_SIZE=5301023539200;
    Query OK, 0 rows affected
    
    obclient> CREATE RESOURCE POOL pool1 unit='unit1',unit_num=1,zone_list=('B_4');
    Query OK, 0 rows affected
    
    obclient> ALTER TENANT tenant1 resource_pool_list=('sys_pool','sys_pool1');
    Query OK, 0 rows affected
    
    obclient> ALTER TENANT tenant1 locality="F@B_1,F@B_2,F@B_3,F@B_4";
    Query OK, 0 rows affected
    
  • Rename a user tenant.

    obclient> ALTER TENANT tenant1 RENAME GLOBAL_NAME TO tenant101;
    Query OK, 0 rows affected
    

Contact Us