CANCEL TRANSFER PARTITION

2024-06-28 05:30:31  Updated

Purpose

You can use this statement to cancel a partition transfer task being executed.

Limitations and considerations

  • You cannot cancel a partition transfer task in the DOING state for a specific partition. You can cancel a partition transfer task in the WAITING or INIT state.

  • Although you can use this statement to cancel all ongoing partition transfer tasks in a tenant, this operation is not atomic. That is, those tasks in the DOING state cannot be canceled.

  • You can execute this statement only in the primary database.

Required privileges

You must have the ALTER SYSTEM privilege.

Syntax

Syntax 1: Cancel the partition transfer 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 partition transfer 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 ID of the partition.
tenant_name The name of the tenant. This parameter is optional and must be specified when you execute this statement in the sys tenant.

Examples

  • Cancel the partition transfer task for a specific partition.

    1. Execute the following statement to query partition transfer tasks in 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 return result is as follows:

      +-------------+-----------+----------+-----------+---------+---------+
      | TENANT_NAME | TENANT_ID | TABLE_ID | OBJECT_ID | TASK_ID | STATUS  |
      +-------------+-----------+----------+-----------+---------+---------+
      | oracle001   |      1004 |   500061 |    500064 |       9 | WAITING |
      +-------------+-----------+----------+-----------+---------+---------+
      1 row in set
      
    2. Execute the following statement to cancel the partition transfer task for a specific partition in the oracle001 tenant:

      ALTER SYSTEM CANCEL TRANSFER PARTITION TABLE_ID = 500061, OBJECT_ID = 500064 TENANT = 'oracle001';
      
  • Cancel all partition transfer tasks in the oracle001 tenant.

    ALTER SYSTEM CANCEL TRANSFER PARTITION ALL TENANT = 'oracle001';
    

References

Contact Us