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 | Specifies the distribution of replicas across zones. For example, F@z1,F@z2,F@z3,R@z4 indicates that z1, z2, and z3 are full-featured replicas, and z4 is a read-only replica. |
| system_var_name | Modifies the system variable value of the tenant. |
| RENAME GLOBAL_NAME TO | Renames the tenant. |
Examples
Change the primary zone of
tenant1tozone2.obclient> ALTER TENANT tenant1 primary_zone='zone2'; Query OK, 0 rows affectedDo 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 listIf you want to scale out the tenant, you can modify the specifications of the resource unit.
obclient> ALTER RESOURCE UNIT unit1 max_cpu 15, max_memory '20G', max_iops 128,max_disk_size '100G', max_session_num 64, MIN_CPU=10, MIN_MEMORY='10G', MIN_IOPS=128Modify the locality of
tenant1to increase the number of replicas.Findicates a full-featured replica, andB_4is the name of the zone to be created.obclient> CREATE RESOURCE UNIT unit1,max_cpu=5,min_cpu=2.5,max_memory= 34359738368, min_memory=30064771072, max_iops=10000,min_iops=5000,max_session_num=9223372036854775807,max_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 affectedRename a user tenant.
obclient> ALTER TENANT tenant1 RENAME GLOBAL_NAME TO tenant101; Query OK, 0 rows affected