OceanBase logo

OceanBase

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

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

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

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.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    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.1
    iconOceanBase Database
    SQL - V 4.3.1
    SQL
    KV
    • 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

    XA transactions

    Last Updated:2026-04-15 08:25:14  Updated
    share
    What is on this page
    DTP model
    Basic concepts
    Atomicity guarantee
    Tight coupling mode
    Optimization mechanism
    One-phase commit
    Read-only transaction branch

    folded

    share

    The eXtended Architecture (XA) standard is a specification released in 1991 by X/Open. XA ensures the atomicity of global transactions in heterogeneous systems.

    DTP model

    A distributed transaction processing (DTP) model defines a standard architecture that contains interactive interfaces for distributed transaction processing. An application program (AP) can access resources that are provided by multiple resource managers (RMs). Each RM is independent and can be heterogeneous. A transaction manager (TM) is responsible for the atomicity of global transactions.

    The following figure shows the interaction between these modules.

    XA transaction

    In the DTP model, OceanBase Database acts as a RM responsible for managing a portion of data resources. To interact with the TM, OceanBase Database provides a set of XA protocol standard interfaces. To implement these interfaces, OceanBase Database internally has a set of subprograms that ensure the consistency of the external semantics for each XA protocol interface. The TM triggers the internal subprograms of OceanBase Database by calling the interfaces. After the subprograms finish processing, they return the results to the TM, which then proceeds with the next steps based on the returned results.

    Basic concepts

    Before you get started with the DTP model, you must understand the following basic concepts:

    • AP

      An AP defines the boundaries of a global transaction and specifies the data access operations that comprise the global transaction.

    • RM

      An RM manages a data resource that can be shared and recovered. For example, a traditional relational database management system can be used as an RM. If an error occurs, the RM can recover the data resource to a consistent state. The OceanBase Database system can be an RM.

    • Transaction branch

      In most cases, a global transaction involves data access in multiple RMs. A global transaction that is executed in each RM can be regarded as a branch of the global transaction.

    • TM

      The TM provides interfaces that define the boundaries of transactions, and is responsible for committing and recovering global transactions. If a global transaction involves multiple RMs, the TM uses the two-phase commit protocol to ensure the atomic commit of the global transaction.

    Atomicity guarantee

    The TM must ensure the atomicity of a global transaction in the commit phase. To this end, the TM adopts the two-phase commit protocol, which includes the following phases:

    1. Prepare phase: The TM sends prepare requests to all RMs involved in the global transaction. After each RM receives a prepare request, the RM persists the changes made by the XA transaction branch in the RM. After the changes are persisted, the RM returns a success response to the TM. In this phase, OceanBase Database persists the redo logs of the transaction branches.

    2. Commit or rollback phase: After the TM receives success responses from all RMs involved in the global transaction, the TM sends commit requests to the RMs. If the TM does not send commit requests, it sends rollback requests to the RMs. After the RMs receive commit or rollback requests, the RMs commit or roll back the transaction branches that correspond to the requests. In this phase, the OceanBase database persists logs for the transaction branches based on the request type. To be specific, OceanBase Database persists commit logs if commit requests are sent and persists rollback logs if rollback requests are sent. After the logs are persisted, the resources for the transaction branch are released.

    Tight coupling mode

    In a DTP model, multiple RMs may access the same database. In this case, multiple transaction branches of a global transaction may access the same database. If the global transaction is in tight coupling mode, multiple transaction branches that access the same database can share resources. In other words, a transaction branch can view the changes in another branch. In OceanBase Database, if two transaction branches are tightly coupled, then they share locks. To be specific, when one of the transaction branches locks a data entry, the other transaction branch considers that it locks the data entry too.

    Optimization mechanism

    One-phase commit

    If a global transaction involves data access in only one RM, the two-phase commit mechanism is not required. To be specific, if the TM finds that a global transaction involves data access only in one RM in the commit phase, the TM can send a one-phase commit request to the RM. If the RM is OceanBase Database, the RM can directly commit the transaction branch after receiving the one-phase commit request. After the request is processed, OceanBase Database can release the resources for the transaction branch. The TM can return the result after receiving the response to the one-phase commit request without the need to send another request to the RM.

    Read-only transaction branch

    If an RM involved in a global transaction provides only the read service, the RM does not need to change data for the durability of the global transaction in the commit phase. After OceanBase Database receives a prepare request for a transaction branch but detects that no data is changed in that branch, it can return a special response, and then release the resources for the transaction branch. After the TM receives the special response and learns that the transaction branch is a read-only branch, the TM no longer sends two-phase commit or rollback requests to the RM.

    Previous topic

    Two-phase commit
    Last

    Next topic

    Overview
    Next
    What is on this page
    DTP model
    Basic concepts
    Atomicity guarantee
    Tight coupling mode
    Optimization mechanism
    One-phase commit
    Read-only transaction branch