Modify a zone

2025-01-26 08:21:58  Updated

You can modify the region and IDC of a zone.

Limitations

Currently, you cannot modify the type of a zone.

Procedure

  1. Log in to the sys tenant of the cluster as the root user.

    Note that you must specify the corresponding options in the following sample code based on your actual database configurations.

    obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -A
    

    For more information about how to connect to a database, see Connection methods (MySQL mode) or Connection methods (Oracle mode).

  2. 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'];
    

    where

    • {ALTER|CHANGE|MODIFY} indicates that the features of the ALTER, CHANGE, and MODIFY keywords are the same. You can use any keyword to modify the attributes of the zone.

    • zone_name specifies the name of the zone whose attributes are to be modified. This statement modifies only one zone at a time.

    • idc_name specifies the name of the IDC where the zone is located.

    • region_name specifies the name of the region where the zone is located.

    For example, to modify the region of the current cluster to Shanghai and the IDC to sh1, execute the following statement:

    obclient [(none)]> ALTER SYSTEM ALTER ZONE zone4 SET REGION 'shanghai',IDC 'sh1';
    
  3. After the statement is executed, you can query the oceanbase.DBA_OB_ZONES view to verify whether the zone is 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 set
    

    For more information about the oceanbase.DBA_OB_ZONES view, see oceanbase.DBA_OB_ZONES.

References

For more zone-related O&M operations, see the following topics:

Contact Us