The CLEAR_BALANCE_WEIGHT procedure is used to clear partition weights.
Limitations and considerations
For V4.2.5, the
CLEAR_BALANCE_WEIGHTprocedure is supported starting from V4.2.5 BP2.Only user tenants can call the
CLEAR_BALANCE_WEIGHTprocedure to clear partition weights. System tenants do not support clearing partition weights.Clearing table-level partition weights removes all table-level weights set on the partitions. If partition-level weights were set for the table, they will be retained.
Syntax
DBMS_BALANCE.CLEAR_BALANCE_WEIGHT(
schema_name IN VARCHAR2,
table_name IN VARCHAR2,
partition_name IN VARCHAR2 DEFAULT NULL,
subpartition_name IN VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| schema_name | The name of the schema to which the table belongs. |
| table_name | The name of the table. |
| partition_name | The name of the primary partition. |
| subpartition_name | The name of the subpartition. This parameter is supported only in syntax, and setting subpartition weights is not currently supported. |
Examples
Assume that user
USR2(in Oracle mode, the schema name is the same as the username) has a tableTBL1_Hwith partition weights set.To query the partition weight information, use the following statement:
obclient[USR2]> SELECT * FROM SYS.DBA_OB_OBJECT_BALANCE_WEIGHT;The query result is as follows:
+----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ | TABLE_ID | PARTITION_ID | SUBPARTITION_ID | WEIGHT | DATABASE_NAME | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | TABLEGROUP_NAME | DATABASE_ID | TABLEGROUP_ID | OBJECT_ID | +----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ | 500002 | NULL | NULL | 1 | USR2 | TBL1_H | NULL | NULL | NULL | 201006 | NULL | 500002 | | 500002 | 500003 | NULL | 2 | USR2 | TBL1_H | P0 | NULL | NULL | 201006 | NULL | 500003 | +----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ 2 rows in setClear the table-level partition weights for the table
TBL1_H.obclient [USR2]> delimiter //obclient[USR2]> BEGIN DBMS_BALANCE.CLEAR_BALANCE_WEIGHT('USR2','TBL1_H'); END;//obclient [USR2]> delimiter ;Query the partition weight information set for the table after clearing.
obclient[USR2]> SELECT * FROM SYS.DBA_OB_OBJECT_BALANCE_WEIGHT;The result is as follows:
+----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ | TABLE_ID | PARTITION_ID | SUBPARTITION_ID | WEIGHT | DATABASE_NAME | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | TABLEGROUP_NAME | DATABASE_ID | TABLEGROUP_ID | OBJECT_ID | +----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ | 500002 | 500003 | NULL | 2 | USR2 | TBL1_H | P0 | NULL | NULL | 201006 | NULL | 500003 | +----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ 1 row in setClear the partition weights for the primary partition
P0in the tableTBL1_H.obclient [USR2]> delimiter //obclient[USR2]> BEGIN DBMS_BALANCE.CLEAR_BALANCE_WEIGHT('USR2','TBL1_H','P0'); END;//obclient [USR2]> delimiter ;Query the partition weight information set for the table again after clearing.
obclient[USR2]> SELECT * FROM SYS.DBA_OB_OBJECT_BALANCE_WEIGHT;The query result is empty.