OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.0
    iconOceanBase Database
    SQL - V 4.3.0
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Locality

    Last Updated:2026-04-15 08:30:00  Updated
    Share
    What is on this page
    Syntax
    Example
    Locality and high-availability architecture

    folded

    Share

    Locality is introduced to describe the types and distribution strategies of multiple replicas of data. The current version of OceanBase Database supports only tenant-level locality, and no longer supports table-level, database-level, or table group-level locality.

    Replicas refer to the data itself, while locality refers to the container that holds the data. This means that the distribution strategies and types of containers described by locality apply to the data they contain.

    In OceanBase Database V4.2.x, you can set locality configurations at the tenant level only. In OceanBase Database V3.x, locality configuration was available for tenants, tables, databases, and table groups.

    Syntax

    The syntax of locality is as follows:

    replicas{count}@location
    

    The following table describes elements in the syntax.

    Element
    Description
    replicas The type of the replica. The value of this element is the name of the replica type. Both full names and abbreviations are supported. You can view the supported replica type names in the name column of the table in Overview of replicas.
    location The location of the replica. It contains a collection of values that are known to the system. The value of this element is the names of zones. You can query for the names of zones in a cluster or tenant from the oceanbase.DBA_OB_ZONES view.
    For more information about the oceanbase.DBA_OB_ZONES view, see oceanbase.DBA_OB_ZONES.
    count The number of replicas. The value is fixed to 1, indicating only one replica. You can leave this element unspecified.

    You can query for the locality of a tenant from the LOCALITY column in the oceanbase.DBA_OB_TENANTS view of the sys tenant. Here is an example:

    obclient> SELECT * FROM oceanbase.DBA_OB_TENANTS limit 10;
    +-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+
    | TENANT_ID | TENANT_NAME | TENANT_TYPE | CREATE_TIME                | MODIFY_TIME                | PRIMARY_ZONE | LOCALITY      | PREVIOUS_LOCALITY | COMPATIBILITY_MODE | STATUS | IN_RECYCLEBIN | LOCKED | TENANT_ROLE | SWITCHOVER_STATUS | SWITCHOVER_EPOCH | SYNC_SCN            | REPLAYABLE_SCN      | READABLE_SCN        | RECOVERY_UNTIL_SCN  | LOG_MODE     | ARBITRATION_SERVICE_STATUS |
    +-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+
    |         1 | sys         | SYS         | 2023-05-17 18:10:19.940353 | 2023-05-17 18:10:19.940353 | RANDOM       | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |
    |      1001 | META$1002   | META        | 2023-05-17 18:15:21.455549 | 2023-05-17 18:15:36.639479 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |
    |      1002 | mysql001    | USER        | 2023-05-17 18:15:21.461276 | 2023-05-17 18:15:36.669988 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1684398681521302749 | 1684398681521302749 | 1684398681345969089 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |
    |      1003 | META$1004   | META        | 2023-05-17 18:18:19.927859 | 2023-05-17 18:18:36.443233 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |
    |      1004 | oracle001   | USER        | 2023-05-17 18:18:19.928914 | 2023-05-17 18:18:36.471606 | zone1        | FULL{1}@zone1 | NULL              | ORACLE             | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1684398681335427475 | 1684398681335427475 | 1684398681144712832 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |
    |      1005 | META$1006   | META        | 2023-05-18 15:48:57.441320 | 2023-05-18 15:49:12.820051 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 |                NULL |                NULL |                NULL |                NULL | NOARCHIVELOG | DISABLED                   |
    |      1006 | mq_t1       | USER        | 2023-05-18 15:48:57.447657 | 2023-05-18 15:49:12.857944 | zone1        | FULL{1}@zone1 | NULL              | MYSQL              | NORMAL | NO            | NO     | PRIMARY     | NORMAL            |                0 | 1684398680916392609 | 1684398680916392609 | 1684398680742451346 | 4611686018427387903 | NOARCHIVELOG | DISABLED                   |
    +-----------+-------------+-------------+----------------------------+----------------------------+--------------+---------------+-------------------+--------------------+--------+---------------+--------+-------------+-------------------+------------------+---------------------+---------------------+---------------------+---------------------+--------------+----------------------------+
    7 rows in set
    

    Example

    The following example shows the locality of different tenants in a cluster that has five zones. The five zones are z1 to z5.

    • Locality of the sys tenant: F@z1,F@z2,F@z3,F@z4,F@z5.

      This locality indicates that the sys tenant has a full-featured replica in z1, z2, z3, z4, and z5, respectively.

    • Locality of tenant 1: F@z1,F@z2,F@z3.

      This locality indicates that tenant1 has a full-featured replica in z1, z2, and z3, respectively.

    • Locality of tenant 2: F@z3,F@z4,F@z5.

      This locality indicates that tenant2 has a full-featured replica in z3, z4, and z5, respectively.

    The following figure shows an example.

    1

    Locality and high-availability architecture

    The multi-replica architecture is one of the strengths that distinguish OceanBase Database from conventional databases. The multi-replica architecture lays a foundation for multi-level lossless disaster recovery capabilities of OceanBase Database, including standalone lossless disaster recovery, lossless disaster recovery for IDCs, and region-wide lossless disaster recovery. OceanBase Database allows you to flexibly adjust the cluster deployment architecture to adapt to the technical evolution of business scenarios.

    The flexible deployment architecture of OceanBase Database relies on the locality settings. Locality describes the replica types and the distribution strategies for replicas across zones. The region attribute of a zone describes the region to which the zone belongs. You can query for the region to which a zone belongs from the REGION column in the oceanbase.DBA_OB_ZONES view. You can adjust the distribution of multiple replicas of a tenant across zones in different regions to flexibly adjust the deployment mode.

    OceanBase Database supports three typical deployment modes: three IDCs in the same region, five IDCs across two regions, and five IDCs across three regions. The following table describes the locality settings in different deployment modes.

    Deployment mode
    Locality
    Zone distribution
    Three IDCs in the same region F@z1,F@z2,F@z3 Zones z1, z2, and z3 belong to IDC 1, IDC 2, and IDC 3 in Region R1, respectively.
    Five IDCs across two regions F@z1,F@z2,F@z3,F@z4,F@z5 Zones z1 and z2 belong to IDC 1 in Region R1.
    Zones z3 and z4 belong to IDC 2 in Region R1.
    Zone z5 belongs to Region R2.
    Five IDCs across three regions F@z1,F@z2,F@z3,F@z4,F@z5 Zones z1 and z2 belong to IDC 1 and IDC 2 in Region R1.
    Zones z3 and z4 belong to IDC 3 and IDC 4 in Region R2.
    Zone z5 belongs to Region R3.

    Previous topic

    Overview
    Last

    Next topic

    View locality
    Next
    What is on this page
    Syntax
    Example
    Locality and high-availability architecture