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

    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.5
    iconOceanBase Database
    SQL - V 4.3.5
    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

    Cancel a replica task

    Last Updated:2026-04-09 02:53:54  Updated
    share
    What is on this page
    Limitations
    Prerequisites
    Procedure
    References

    folded

    share

    There is a restriction on the execution of a disaster recovery task: a tenant log stream allows only one replica task at a time, excluding replica migration tasks. As a result, some emergency tasks may need to wait for the completion of the existing task before they can be executed. If you need to prioritize the execution of an emergency task, you can manually cancel the running replica task by using the ALTER SYSTEM CANCEL REPLICA TASK command.

    Limitations

    • You can cancel only a replica adding or migration task.

      Note

      In the current version, if a replica migration task is generated due to a unit migration and the destination of the migration task has no units, the system will automatically cancel the corresponding replica migration task. You do not need to manually cancel it.

    • You can cancel replica tasks of all tenants in the sys tenant but cancel only replica tasks of the current tenant in a user tenant.

    Prerequisites

    • You have the ALTER SYSTEM privilege.

    • You have the SELECT privilege on the following views:

      • DBA_OB_LS_REPLICA_TASKS and CDB_OB_LS_REPLICA_TASKS

      • DBA_OB_LS_REPLICA_TASK_HISTORY and CDB_OB_LS_REPLICA_TASK_HISTORY

    Procedure

    Assume that a task to migrate a read-only replica of log stream 1001 of a tenant named tenant1 is in progress and a full-featured replica needs to be added to an available OBServer node to ensure high availability upon an exception of the cluster. However, the read-only replica involves a large amount of data, and the replica migration task is unlikely to complete anytime soon. Consequently, the emergency task to add a full-featured replica cannot be performed immediately. In this case, you can cancel the ongoing replica migration task and perform the emergency task with priority.

    1. Log in to the target tenant.

      Here is an example:

      obclient -h172.30.xxx.xxx -P2883 -uroot@tenant1#obdemo -pxxxx -A
      

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

    2. Query the ongoing replica task.

      • sys tenant

        obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_LS_REPLICA_TASKS;
        

        For more information about the fields in the CDB_OB_LS_REPLICA_TASKS view, see CDB_OB_LS_REPLICA_TASKS.

      • User tenant

        MySQL mode
        Oracle mode

        Execute the following statement in MySQL mode:

        obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_LS_REPLICA_TASKS;
        

        Execute the following statement in Oracle mode:

        obclient [SYS]> SELECT * FROM SYS.DBA_OB_LS_REPLICA_TASKS;
        

        A sample query result is as follows:

        +-------+-----------------+------------------------------------+-------------+----------+-----------------------+-------------------------+-----------------------------+---------------------+-----------------------+-------------------------+-----------------------------+---------------------+--------------------+----------------------+-----------+------------------+--------------------+---------------------+---------------------+---------------------+---------------------------------------------+
        | LS_ID | TASK_TYPE       | TASK_ID                            | TASK_STATUS | PRIORITY | TARGET_REPLICA_SVR_IP | TARGET_REPLICA_SVR_PORT | TARGET_PAXOS_REPLICA_NUMBER | TARGET_REPLICA_TYPE | SOURCE_REPLICA_SVR_IP | SOURCE_REPLICA_SVR_PORT | SOURCE_PAXOS_REPLICA_NUMBER | SOURCE_REPLICA_TYPE | DATA_SOURCE_SVR_IP | DATA_SOURCE_SVR_PORT | IS_MANUAL | TASK_EXEC_SVR_IP | TASK_EXEC_SVR_PORT | CREATE_TIME         | START_TIME          | MODIFY_TIME         | COMMENT                                     |
        +-------+-----------------+------------------------------------+-------------+----------+-----------------------+-------------------------+-----------------------------+---------------------+-----------------------+-------------------------+-----------------------------+---------------------+--------------------+----------------------+-----------+------------------+--------------------+---------------------+---------------------+---------------------+---------------------------------------------+
        |  1001 | MIGRATE REPLICA | Y13CE64586BD4-000610C5F3EDBBCB-0-0 | INPROGRESS  | LOW      | 100.xx.xxx.002        |                    5072 |                           2 | FULL                | 100.xx.xxx.003        |                    5073 |                           2 | FULL                | 100.xx.xxx.003     |                 5073 | FALSE     | 100.xx.xxx.002   |               5072 | 2024-02-07 15:23:04 | 2024-02-07 15:23:04 | 2024-02-07 15:23:04 | migrate replica due to unit group not match |
        +-------+-----------------+------------------------------------+-------------+----------+-----------------------+-----------------------  +-----------------------------+---------------------+-----------------------+-------------------------+-----------------------------+---------------------+--------------------+----------------------+-----------+------------------+--------------------+---------------------+---------------------+---------------------+---------------------------------------------+
        1 row in set
        

        The query result shows that the replica task with the task type of MIGRATE REPLICA is in progress. Record the task ID of the task.

        For more information about the fields in the DBA_OB_LS_REPLICA_TASKS view, see DBA_OB_LS_REPLICA_TASKS.

    3. Execute the ALTER SYSTEM CANCEL REPLICA TASK statement to cancel the ongoing replica task.

      The syntax is as follows:

      ALTER SYSTEM CANCEL REPLICA TASK TASK_ID [=] 'task_id' [TENANT [=] 'tenant_name'];
      

      The parameters in the syntax are described as follows:

      • task_id: the task ID of the replica task to be canceled.

      • tenant_name: the name of the target tenant. You can specify another tenant in the sys tenant and specify only the current tenant in a user tenant. If this parameter is not explicitly specified, the name of the current tenant is used. You cannot use the all, all_user, or all_meta option in this statement to specify all tenants, all user tenants, or all meta tenants.

      • This statement cancels only one replica task of the tenant at a time.

      Here is an example:

      obclient> ALTER SYSTEM CANCEL REPLICA TASK TASK_ID = 'Y13CE64586BD4-000610C5F3EDBBCB-0-0';
      
    4. Check whether the replica task is canceled.

      • sys tenant

        obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_LS_REPLICA_TASK_HISTORY WHERE TASK_ID = 'Y13CE64586BD4-000610C5F3EDBBCB-0-0';
        

        For more information about the fields in the CDB_OB_LS_REPLICA_TASK_HISTORY view, see CDB_OB_LS_REPLICA_TASK_HISTORY.

      • User tenant

        MySQL mode
        Oracle mode

        Execute the following statement in MySQL mode:

        obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_LS_REPLICA_TASK_HISTORY WHERE TASK_ID = 'Y13CE64586BD4-000610C5F3EDBBCB-0-0';
        

        Execute the following statement in Oracle mode:

        obclient [SYS]> SELECT * FROM SYS.DBA_OB_LS_REPLICA_TASK_HISTORY WHERE TASK_ID = 'Y13CE64586BD4-000610C5F3EDBBCB-0-0';
        

        A sample query result is as follows:

        +-------+-----------------+------------------------------------+-------------+----------+-----------------------+-------------------------+-----------------------------+---------------------+-----------------------+-------------------------+-----------------------------+---------------------+--------------------+----------------------+-----------+------------------+--------------------+---------------------+---------------------+---------------------+---------------------+-------------------------------------------------------------------------------------------------+---------------------------------------------+
        | LS_ID | TASK_TYPE       | TASK_ID                            | TASK_STATUS | PRIORITY | TARGET_REPLICA_SVR_IP | TARGET_REPLICA_SVR_PORT | TARGET_PAXOS_REPLICA_NUMBER | TARGET_REPLICA_TYPE | SOURCE_REPLICA_SVR_IP | SOURCE_REPLICA_SVR_PORT | SOURCE_PAXOS_REPLICA_NUMBER | SOURCE_REPLICA_TYPE | DATA_SOURCE_SVR_IP | DATA_SOURCE_SVR_PORT | IS_MANUAL | TASK_EXEC_SVR_IP | TASK_EXEC_SVR_PORT | CREATE_TIME         | START_TIME          | MODIFY_TIME         | FINISH_TIME         | EXECUTE_RESULT                                                                                  | COMMENT                                     |
        +-------+-----------------+------------------------------------+-------------+----------+-----------------------+-------------------------+-----------------------------+---------------------+-----------------------+-------------------------+-----------------------------+---------------------+--------------------+----------------------+-----------+------------------+--------------------+---------------------+---------------------+---------------------+---------------------+-------------------------------------------------------------------------------------------------+---------------------------------------------+
        |  1001 | MIGRATE REPLICA | Y13CE64586BD4-000610C5F3EDBBCB-0-0 | CANCELED    | LOW      | 100.xx.xxx.002        |                    5072 |                           2 | FULL                | 100.xx.xxx.003        |                    5073 |                           2 | FULL                | 100.xx.xxx.003     |                 5073 | FALSE     | 100.xx.xxx.002   |               5072 | 2024-02-07 15:54:35 | 2024-02-07 15:54:31 | 2024-02-07 15:54:35 | 2024-02-07 15:54:34 | ret:-4072, OB_CANCELED; elapsed:4109659; comment:[storage] receive task reply from storage rpc; | migrate replica due to unit group not match |
        +-------+-----------------+------------------------------------+-------------+----------+-----------------------+-------------------------+-----------------------------+---------------------+-----------------------+-------------------------+-----------------------------+---------------------+--------------------+----------------------+-----------+------------------+--------------------+---------------------+---------------------+---------------------+---------------------+-------------------------------------------------------------------------------------------------+---------------------------------------------+
        1 row in set
        

        The query result shows that the status of the task is CANCELED.

        For more information about the fields in the DBA_OB_LS_REPLICA_TASK_HISTORY view, see DBA_OB_LS_REPLICA_TASK_HISTORY.

    References

    • Add replicas

    • Remove replicas

    • Convert the type of a replica

    • Modify the number of Paxos replicas of a log stream

    • Migrate replicas

    Previous topic

    Modify the number of Paxos replicas of a log stream
    Last

    Next topic

    Traffic distribution
    Next
    What is on this page
    Limitations
    Prerequisites
    Procedure
    References