You can modify the region and IDC of a zone.
Limitations
Currently, you cannot modify the type of a zone.
Procedure
Log on to the
systenant of the cluster as therootuser.Run the following command to log on. You must replace the related information in the command based on the actual database environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys -p***** -AFor more information about how to connect to OceanBase Database, see Overview of the Connect to OceanBase Database chapter in Develop Applications in MySQL Mode and Overview of the Connect to OceanBase Database chapter in Develop Applications in Oracle Mode.
Execute the following statement to modify the attributes of a zone:
obclient [(none)]> ALTER SYSTEM {ALTER|CHANGE|MODIFY} ZONE zone_name SET [IDC [=]'idc_name', REGION [=]'region_name'];{ALTER|CHANGE|MODIFY}: indicates that the features of theALTER,CHANGE, andMODIFYkeywords are the same. You can use any keyword to modify the attributes of the zone.zone_name: the name of the zone whose attributes are to be modified. This statement modifies only one zone at a time.idc_name: the name of the IDC where the zone is located.region_name: the name of the region where the zone is located.
For example, to modify the region of the current cluster to
Shanghaiand the IDC tosh1, execute the following statement:obclient [(none)]> ALTER SYSTEM ALTER ZONE zone4 SET REGION 'shanghai',IDC 'sh1';After the statement is executed, you can query the
oceanbase.DBA_OB_ZONESview to verify whether the attributes are modified.obclient [(none)]> SELECT * FROM oceanbase.DBA_OB_ZONES; +-------+----------------------------+----------------------------+----------+-----+----------+-----------+ | ZONE | CREATE_TIME | MODIFY_TIME | STATUS | IDC | REGION | TYPE | +-------+----------------------------+----------------------------+----------+-----+----------+-----------+ | zone1 | 2022-12-20 17:50:17.168745 | 2022-12-20 17:50:40.801054 | ACTIVE | HZ0 | hangzhou | ReadWrite | | zone2 | 2022-12-20 17:50:17.168745 | 2022-12-20 17:50:40.809504 | ACTIVE | HZ0 | hangzhou | ReadWrite | | zone3 | 2022-12-20 17:50:17.169804 | 2022-12-20 17:50:40.815833 | ACTIVE | SH0 | shanghai | ReadWrite | | zone4 | 2023-01-06 15:25:07.190559 | 2023-01-06 15:25:29.281242 | INACTIVE | sh1 | shanghai | ReadWrite | +-------+----------------------------+----------------------------+----------+-----+----------+-----------+ 4 rows in setFor more information about the
oceanbase.DBA_OB_ZONESview, see oceanbase.DBA_OB_ZONES.
More information
For more zone-related O&M operations, see the following topics: