Purpose
This statement is used to manually cancel a running replica task.
Limitations and considerations
- In the current version, you can only cancel two types of replica tasks: adding a replica and migrating a replica. You can view the running disaster recovery tasks by querying the
DBA_OB_LS_REPLICA_TASKSview. - This statement allows you to cancel only one disaster recovery task for a tenant at a time.
- The cancel command is idempotent. Executing it multiple times has the same effect as executing it once.
- You must ensure that the task you want to cancel is still running. If the task has already completed, it cannot be canceled.
- A successful return from the cancel command only indicates that the RS has sent the cancel RPC to the underlying layer. The underlying layer does not guarantee that the cancellation will succeed, as replica tasks are executed in multiple stages. If the task has reached the final stage, it cannot be canceled. You can check the task cancellation result by querying the
TASK_STATUSfield in theDBA_OB_LS_REPLICA_TASK_HISTORYview. If the status isCANCELED, the cancellation was successful.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, 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 TASK_ID of the replica task to be canceled. |
| tenant_name | Optional. The name of the tenant to operate on. If not specified, the current tenant is used.
NoticeThe system tenant can specify other tenants, while a user tenant can only specify itself. This statement does not support using |
Examples
Execute the following command in the sys tenant to cancel the running replica task in the mysql001 tenant.
ALTER SYSTEM CANCEL REPLICA TASK
TASK_ID = 'Y13CE64586BD4-000610C5F3EDBBCB-0-0'
TENANT = 'mysql001';
For more examples of canceling a running replica task, see Cancel a replica task.
References
- For information about manually adding a log stream replica, see ADD REPLICA.
- For information about removing a log stream replica, see REMOVE REPLICA.
- For information about converting a log stream replica type, see MODIFY REPLICA.
- For information about migrating a log stream replica, see MIGRATE REPLICA.
- For information about modifying the
PAXOS_REPLICA_NUMof a log stream, see MODIFY PAXOS_REPLICA_NUM.
