The CLEAR_BALANCE_WEIGHT procedure is used to clear partition weights.
Limitations and considerations
Only user tenants can clear partition weights by calling the
CLEAR_BALANCE_WEIGHTprocedure. 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 schema name of the table. |
| 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 cannot be used to set subpartition weights. |
Examples
Assume that in the
SYSuser (in Oracle mode, the schema name is the same as the username), there is a tableTBL1_Hwith partition weights set.To query the partition weight information, use the following statement:
obclient(SYS@oracle001)[SYS]> 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 | SYS | TBL1_H | NULL | NULL | NULL | 201006 | NULL | 500002 | | 500002 | 500003 | NULL | 2 | SYS | TBL1_H | P0 | NULL | NULL | 201006 | NULL | 500003 | +----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ 2 rows in setClear the table-level partition weights for the table
TBL1_H.obclient(SYS@oracle001)[SYS]> delimiter //oobclient(SYS@oracle001)[SYS]> BEGIN DBMS_BALANCE.CLEAR_BALANCE_WEIGHT('SYS','TBL1_H'); END;//obclient(SYS@oracle001)[SYS]> delimiter ;Query the partition weight information set for the table after clearing.
obclient(SYS@oracle001)[SYS]> 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 | SYS | TBL1_H | P0 | NULL | NULL | 201006 | NULL | 500003 | +----------+--------------+-----------------+--------+---------------+------------+----------------+-------------------+-----------------+-------------+---------------+-----------+ 1 row in setClear the partition weights for the primary partition
P0in the tableTBL1_H.obclient(SYS@oracle001)[SYS]> delimiter //obclient(SYS@oracle001)[SYS]> BEGIN DBMS_BALANCE.CLEAR_BALANCE_WEIGHT('SYS','TBL1_H','P0'); END;//obclient(SYS@oracle001)[SYS]> delimiter ;Query the partition weight information set for the table again after clearing.
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_OBJECT_BALANCE_WEIGHT;The query result is empty.
