TheSET_CONSUMER_GROUP_MAPPING procedure adds, deletes, or modifies an entry that maps a session to a resource consumer group based on the logon and operating attributes of the session.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING(
attribute IN VARCHAR2,
value IN VARCHAR2,
consumer_group IN VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| attribute | The attribute to be added or modified. In the current database version, you can add or modify only the ORACLE_USER attribute which specifies the database username, the COLUMN attribute, and the ORACLE_FUNCTION attribute. Background tasks of OceanBase Database, such as major compactions, minor compactions, data backup, data restoration, and data completion, do not belong to user operations and may probably contend for the CPU and I/O resources of other users and tasks. Therefore, you can specify mappings between ORACLE_FUNCTION and different background tasks so that only the resources in the corresponding resource consumer group are available for the tasks. |
| value | The attribute value, which contains the absolute mapping and a regular expression. |
| consumer_group | The name of the mapped-to resource consumer group. If you set the value to NULL, the mapping will be deleted. |
Considerations
If no mapping exists between the specified attribute and value, a mapping to the specified resource consumer group will be created. If a mapping exists between the specified attribute and value, the mapped-to resource consumer group will be updated to the specified consumer group. If the consumer_group parameter is set to NULL, any mapping between the specified attribute and value will be deleted.
The following table describes the predefined mappings between the resource consumer group and the ORACLE_FUNCTION attribute in OceanBase Database. You can call the DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING procedure to modify or delete these mappings.
| Attribute | Value | Description |
|---|---|---|
| ORACLE_FUNCTION | COMPACTION_HIGH | Corresponding to MINI_MERGE and DDL KV merge tasks. |
| ORACLE_FUNCTION | COMPACTION_MID | Corresponding to MINOR_MERGE tasks. |
| ORACLE_FUNCTION | COMPACTION_LOW | Corresponding to MAJOR_MERGE tasks. |
| ORACLE_FUNCTION | HA_HIGH | Corresponding to replication, rebuild, and restoration tasks. |
| ORACLE_FUNCTION | HA_MID | Corresponding to migration tasks. |
| ORACLE_FUNCTION | HA_LOW | Corresponding to backup and backup cleanup tasks. |
| ORACLE_FUNCTION | DDL | Corresponding to unique index verification, column deletion, and data completion operations. |
| ORACLE_FUNCTION | DDL_HIGH | Corresponding to minor compactions for DDL MemTables. |
Examples
obclient> CALL DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING(
attribute => 'COLUMN' ,
value => 't2.c3 = 3 for user1',
consumer_group => 'group1');
Query OK, 0 rows affected