Purpose
You can use this statement to cancel a balance job being executed. For example, you can cancel a balance job that does not meet your requirements. Or, you can cancel an ongoing balance job that has delayed a partition transfer task that you have initiated.
Limitations and considerations
You can execute this statement only in the primary database.
Required privileges
You must have the ALTER SYSTEM privilege.
Syntax
ALTER SYSTEM CANCEL BALANCE JOB [TENANT = 'tenant_name'];
Parameters
| Parameter | Description |
|---|---|
| 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
Execute the following statement to query the balance jobs that are being executed:
SELECT T.TENANT_NAME, J.TENANT_ID, J.JOB_ID, J.CREATE_TIME, J.MODIFY_TIME, J.BALANCE_STRATEGY, J.JOB_TYPE, j.STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS J, oceanbase.DBA_OB_TENANTS T WHERE J.TENANT_ID = T.TENANT_ID;The return result is as follows:
+-------------+-----------+--------+----------------------------+----------------------------+---------------------------+--------------+--------+ | TENANT_NAME | TENANT_ID | JOB_ID | CREATE_TIME | MODIFY_TIME | BALANCE_STRATEGY | JOB_TYPE | STATUS | +-------------+-----------+--------+----------------------------+----------------------------+---------------------------+--------------+--------+ | oracle001 | 1004 | 300793 | 2024-02-29 16:45:12.864110 | 2024-02-29 16:45:12.864110 | LS balance by shrink | LS_BALANCE | DOING | +-------------+-----------+--------+----------------------------+----------------------------+---------------------------+--------------+--------+ 1 row in setExecute the following statement to cancel a job that does not meet expectations:
ALTER SYSTEM CANCEL BALANCE JOB TENANT = 'oracle001';