To describe the types and distribution strategies of multiple replicas of data, we introduce the concept of locality. OceanBase Database only supports tenant-level locality in the current version, and no longer supports configuring locality at the table, database, or table group level.
A replica refers to data, while locality describes the container that holds the data. Therefore, the data within the container inherits the locality attributes of the container, including its type and distribution strategy.
OceanBase Database only supports tenant-level locality in the current version. However, OceanBase Database V3.x also supports configuring locality at the table, database, and table group levels.
Locality syntax
The syntax structure for locality is as follows:
replicas{quantity}@location
The meaning of each element in the syntax is shown in the following table:
| Element | Description |
|---|---|
| replicas | Specifies the replica type. The value of replicas is the replica name, which can be obtained from the Name column of the replica type description table in Replica introduction. It supports both the full name and abbreviation. |
| location | Specifies the location. It is a set of known enumeration values in the system. The value of location is the name of a zone. You can query the zone names in the oceanbase.DBA_OB_ZONES view in the cluster and tenant. For more information about the DBA_OB_ZONES view, see oceanbase.DBA_OB_ZONES. |
| quantity | Is fixed at 1, indicating one replica. You can omit this parameter. |
You can view the locality attribute of a tenant in the LOCALITY column of the oceanbase.DBA_OB_TENANTS view in the sys tenant. For example:
obclient(root@sys)[oceanbase]> SELECT TENANT_ID, TENANT_NAME, TENANT_TYPE, CREATE_TIME, PRIMARY_ZONE, LOCALITY, COMPATIBILITY_MODE, STATUS FROM oceanbase.DBA_OB_TENANTS;
The query result is as follows:
+-----------+-------------+-------------+----------------------------+--------------+----------------------------------------------+--------------------+--------+
| TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME | PRIMARY_ZONE | LOCALITY | COMPATIBILITY_MODE | STATUS |
+-----------+-------------+-------------+----------------------------+--------------+----------------------------------------------+--------------------+--------+
| 1 | sys | SYS | 2025-12-29 15:43:42.930290 | RANDOM | FULL{1}@zone1 | MYSQL | NORMAL |
| 1001 | META$1002 | META | 2025-12-29 15:44:48.700796 | zone1;zone2 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | MYSQL | NORMAL |
| 1002 | mysql001 | USER | 2025-12-29 15:44:48.704354 | zone1;zone2 | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | MYSQL | NORMAL |
| 1003 | META$1004 | META | 2025-12-29 15:50:35.033311 | zone1 | FULL{1}@zone1 | MYSQL | NORMAL |
| 1004 | oracle001 | USER | 2025-12-29 15:50:35.034367 | zone1 | FULL{1}@zone1 | ORACLE | NORMAL |
+-----------+-------------+-------------+----------------------------+--------------+----------------------------------------------+--------------------+--------+
5 rows in set
Examples
The following example shows multiple tenants with different locality configurations in an OceanBase cluster with five zones (z1 to z5), and their locality attributes:
The locality of the sys tenant is
F@z1,F@z2,F@z3,F@z4,F@z5.This indicates that the sys tenant has one full-featured replica in each of z1, z2, z3, z4, and z5.
The locality of tenant1 is
F@z1,F@z2,F@z3.This indicates that tenant1 has one full-featured replica in each of z1, z2, and z3.
The locality of tenant2 is
F@z3,F@z4,F@z5.This indicates that tenant2 has one full-featured replica in each of z3, z4, and z5.
The following figure shows the distribution of replicas:

Locality attributes and high availability architecture
The multi-replica architecture is a key advantage of OceanBase Database over traditional databases. This architecture forms the foundation for OceanBase Database's multi-level lossless disaster recovery capabilities, including single-machine, IDC, and regional lossless disaster recovery. OceanBase Database allows for flexible adjustments to the cluster deployment architecture to meet the evolving needs of different business scenarios.
The flexible deployment architecture of OceanBase Database is primarily reflected through its locality attributes. In addition to describing the replica types, locality also defines the distribution strategy of replicas across zones. Each zone has a region attribute, which can be viewed in the REGION column of the oceanbase.DBA_OB_ZONES view. This attribute describes the geographical distribution of the zone. By adjusting the distribution of multiple replicas of a tenant across different zones in various regions, OceanBase Database achieves flexible deployment.
OceanBase Database supports three typical deployment modes: three IDCs in the same region, three IDCs in two regions, and five IDCs across three regions. Here are some examples of locality attributes for these modes:
| Deployment mode | Locality attribute | Zone distribution |
|---|---|---|
| Three IDCs in the same region | F@z1,F@z2,F@z3 |
z1, z2, and z3 are located in IDCs idc1, idc2, and idc3 in Region R1, respectively. |
| Three IDCs in two regions | F@z1,F@z2,F@z3,F@z4,F@z5 |
z1 and z2 are located in IDC idc1 in Region R1; z3 and z4 are located in IDC idc2 in Region R1; z5 is located in Region R2. |
| Five IDCs across three regions | F@z1,F@z2,F@z3,F@z4,F@z5 |
z1 and z2 are located in IDCs idc1 and idc2 in Region R1; z3 and z4 are located in IDCs idc3 and idc4 in Region R2; z5 is located in Region R3. |