Purpose
This statement is used to cancel a running Transfer Partition task.
Limitations and considerations
If you want to cancel a Transfer Partition task for a specific partition, you cannot cancel the task if it is in the
DOINGstate. However, you can cancel the task if it is in theWAITINGorINITstate.If you want to cancel all Transfer Partition tasks in a tenant, the 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 has 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 in 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 you want to cancel the task. This parameter is optional. If you execute this statement in the sys tenant, you must specify this parameter. |
Examples
Cancel a Transfer Partition task for a specific partition.
Query the Transfer Partition tasks in the tenant by executing the following statement:
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 result set 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 a specific partition in the
oracle001tenant.ALTER SYSTEM CANCEL TRANSFER PARTITION TABLE_ID = 500061, OBJECT_ID = 500064 TENANT = 'oracle001';
Cancel all Transfer Partition tasks in the
oracle001tenant.ALTER SYSTEM CANCEL TRANSFER PARTITION ALL TENANT = 'oracle001';