Purpose
This statement is used to cancel a running Transfer Partition task.
Limitations and considerations
When canceling a Transfer Partition task for a specific partition, the task must be in the
WAITINGorINITstate to be canceled. If the task is in theDOINGstate, cancellation is not allowed.When canceling all Transfer Partition tasks for a tenant, although the command supports canceling all ongoing tasks, this operation is not atomic. That is, if some tasks are in the
DOINGstate, they cannot be canceled.This statement can only be executed on the primary database.
Privilege requirements
The current user must have the ALTER SYSTEM privilege.
Syntax
Syntax 1: Cancel a Transfer Partition task for a specific partition
ALTER SYSTEM CANCEL TRANSFER PARTITION TABLE_ID [=] table_id, OBJECT_ID [=] object_id [TENANT = 'tenant_name'];
Syntax 2: Cancel all Transfer Partition tasks for a tenant
ALTER SYSTEM CANCEL TRANSFER PARTITION ALL [TENANT = 'tenant_name'];
Parameters
| Parameter | Description |
|---|---|
| table_id | The ID of the table. |
| object_id | The unique identifier of the partition. |
| tenant_name | The name of the tenant for which to cancel the task. This parameter is optional but required when executed in the sys tenant. |
Examples
Cancel a Transfer Partition task for a specific partition.
Execute the following statement to query the Transfer Partition tasks for the tenant.
SELECT T.TENANT_NAME, S.TENANT_ID, S.TABLE_ID, S.OBJECT_ID, S.TASK_ID, S.STATUS FROM oceanbase.CDB_OB_TRANSFER_PARTITION_TASKS S, oceanbase.DBA_OB_TENANTS T WHERE S.TENANT_ID = T.TENANT_ID;The returned result is as follows:
+-------------+-----------+----------+-----------+---------+---------+ | TENANT_NAME | TENANT_ID | TABLE_ID | OBJECT_ID | TASK_ID | STATUS | +-------------+-----------+----------+-----------+---------+---------+ | oracle001 | 1004 | 500061 | 500064 | 9 | WAITING | +-------------+-----------+----------+-----------+---------+---------+ 1 row in setExecute the following statement to cancel the Transfer Partition task for the
oracle001tenant.ALTER SYSTEM CANCEL TRANSFER PARTITION TABLE_ID = 500061, OBJECT_ID = 500064 TENANT = 'oracle001';
Cancel all Transfer Partition tasks for the
oracle001tenant.ALTER SYSTEM CANCEL TRANSFER PARTITION ALL TENANT = 'oracle001';
