CLEAR_BALANCE_WEIGHT is used to clear the partition weights.
Limitations and considerations
Only user tenants can call the
CLEAR_BALANCE_WEIGHTprocedure to clear the partition weights. System tenants cannot clear the partition weights.Clearing the table-level partition weights deletes 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 setting subpartition weights is not currently supported. |
Examples
Assume that in the
SYSuser (in Oracle-compatible mode, the schema name is the same as the username), there is a tableTBL1_Hwith partition weights set.Query the partition weight information, using 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 of the
TBL1_Htable.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 weights 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 of the primary partition
P0in theTBL1_Htable.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 weights set for the table again after clearing.
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_OBJECT_BALANCE_WEIGHT;The query result is empty.