Purpose
You can use the CANCEL REPLICA TASK statement to cancel an ongoing replica task.
Limitations and considerations
- You can cancel only a replica adding or migration task. You can query the
DBA_OB_LS_REPLICA_TASKSview for ongoing replica tasks. - This statement cancels only one replica task of the tenant at a time.
- The cancellation statement is reentrant. Executing the statement multiple times produces the same effect as executing the statement only once.
- Make sure that the replica task to be canceled is in progress. You cannot cancel a completed replica task.
- If the cancellation statement returns success, it only means that RootService has sent the cancellation RPC to the underlying layer, but the underlying layer cannot guarantee that the replica task can be successfully canceled. This is because the replica task is executed in multiple phases, and if the task has reached the last execution phase, it cannot be canceled. You can query the
DBA_OB_LS_REPLICA_TASK_HISTORYview for the task cancellation result. If the value of theTASK_STATUScolumn isCANCELED, the replica task is successfully canceled.
Required privileges
To execute this statement, you must have the ALTER SYSTEM privilege. For more information about privileges in OceanBase Database, see Privilege types in MySQL mode and Privilege types in Oracle mode.
Syntax
ALTER SYSTEM CANCEL REPLICA TASK
TASK_ID [=] task_id
[TENANT [=] '$tenant_name'];
Parameters
| Parameter | Description |
|---|---|
| task_id | The ID of the replica task to be canceled. |
| tenant_name | Optional. The name of the target tenant. If this parameter is not specified, the name of the current tenant is used.
NoticeYou can specify another tenant in the |
Examples
Execute the following statement in the sys tenant to cancel the ongoing replica task of the mysql001 tenant:
ALTER SYSTEM CANCEL REPLICA TASK
TASK_ID = 'Y13CE64586BD4-000610C5F3EDBBCB-0-0'
TENANT = 'mysql001';
For more information about how to cancel an ongoing replica task, see Cancel a replica task.
References
- For information about how to add a replica, see ADD REPLICA.
- For information about how to drop a replica, see REMOVE REPLICA.
- For information about how to modify the type of a replica, see MODIFY REPLICA.
- For information about how to migrate a replica, see MIGRATE REPLICA.
- For information about how to modify the
PAXOS_REPLICA_NUMparameter for a replica, see MODIFY PAXOS_REPLICA_NUM.