One, the Resource Manager (DRM) consists of three elements:
Resource Consumption Group (Resource_consumer_group)
Resource Planning (Resource_plan)
Resource planning directives (resource_plan_directive)
To perform DRM-related operations, you must have Administer_resource_manager system permissions.
Ii. pending domain (pending area)
All three of the DRM elements must be created in the pending domain and then committed.
1. Create pending fields
exec Dbms_resource_manager.create_pending_area;
2. Verify pending fields
exec Dbms_resource_manager.validate_pending_area;
Verify that the content in the domain is legitimate.
3. Clear Pending fields
exec Dbms_resource_manager.clear_pending_area;
After you execute this command, the pending fields and the contents of the pending fields are deleted together.
4. Submit Pending fields
exec Dbms_resource_manager.submit_pending_area;
After executing this command, it is equivalent to performing a validation, commit, and purge three commands. The content in the pending fields is stored in the data dictionary, waiting to be enabled.
Third, resource consumption group
A user can belong to multiple consumer groups, but a session can only be subordinate to one consumer group at a time.
ORACLE has predefined 4 consumer groups:
Default_consumer_group: Users and sessions that are not assigned to the consumer group.
Other_groups: The current resource plan does not explicitly specify the resource allocation for all consumer groups. This group must be included in any resource plan.
Sys_group and Low_group: A consumer group used to perform system planning.
1, create, UPDATE, delete consumer group ()
Create:
EXEC dbms_resource_manager.create_cosumer_group (' Group name ', ' annotation ');
Update:
EXEC dbms_resource_manager.update_consumer_group (' Group name ', ' annotation ');
Delete:
EXEC dbms_resource_manager.delete_consumer_group (' Group name ');
After this command is executed, users and sessions that are subordinate to this group will automatically go to Default_consumer_group.
2. Assign user session to consumer group (consumer group Mapping)
The session can be dynamically allocated to the consumer group based on the properties of the session, becoming a consumer group mapping.
(1) Set mapping:
Dbms_resource_manager.set_consumer_group_mapping (
Attribute => Oracle_user,
Value => ' User1,
Consumer_group => ' Low_group ');
For example, when the Oracle user attribute value for a session is User1, it is assigned to the consumer group Low_group.
(2) Set mapping priority:
Since the two attributes of a session may appear to satisfy two different mapping rules, which rule should be obeyed? --You can set the priority of each attribute and obey the high priority attribute.
Dbms_resource_manager.set_mapping_priority (
Oracle_user => 1,
Client_os_user => 2);
(3) Dynamic conversion session of the consumer group
Unique identity based on session conversion consumer group: (The session unique identity is composed of session_id and session_serial, the values of which are in the V$session view).
Dbms_resource_manager.switch_consumer_group_for_sess (
session_id => ' 56 ',
Session_serial => ' 106 ',
Consumer_group => ' Low_group ');
User-converted consumer groups based on users of the session: (Converts all sessions under the user to a consumer group)
Dbms_resource_manager.switch_consumer_group_for_user (
User => ' User1 ',
Consumer_group => ' Low_group ');
Consumer groups who convert their current session: (using Dbms_session package)
Dbms_session.switch_current_consumer_group (
New_consumer_group => ' Low_group ');
Converting your current session's consumer group requires specific permissions:
Dbms_resource_manager_privs.grant_switch_consumer_group (
Grantee_name => ' user1 ',
Consumer_group => ' Low_group ',
Grant_option => ' false ');
Revoke this permission:
Dbms_resource_manager_privs.revoke_switch_consumer_group (
Grantee_name => ' user1 ',
Consumer_group => ' Low_group ');
Iv. Resource Planning
Divided into simple resource planning and complex resource planning.
1. Simple Resource Plan
Has the following characteristics:
(1) Three elements are defined in a process.
(2) Only CPU resources can be allocated.
(3) CPU resources (that is, percentages) can only be allocated using the emphasis method.
(4) The maximum number of consumer groups allocated is 8.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/
Create:
Dbms_resource_manager.create_simple_plan (
Simple_plan => ' plan name ',
Consumer_group1 => ' consumer group 1 ',
GROUP1_CPU => 50,
Consumer_group2 => ' consumer group 2 ',
GROUP2_CPU => 50);
2. Complex resource planning
Characteristics:
(1) Three elements must be created separately.
(2) You can embed a nested plan.
Create:
Dbms_resource_manager.create_plan (
Plan => ' program name ',
Comment => ' notes ');
3. Modify the Resource plan:
Dbms_resource_manager.update_plan (
Plan => ' program name ',
New_ Property => ' new value ');
4. Delete Resource plan:
Dbms_resource_manager.delete_plan (' plan name ');
Or
Dbms_resource_manager.delete_plan_cascade (' plan name ');
Add the cascade parameter to delete the elements in the plan.
V. Planning directives
Create:
Dbms_resource_manager.create_plan_directive (
Plan => ' program name ',
Group_or_subplan => ' consumer group or sub-plan ',
Resource constraint parameters);
Note: You can create directives for a child plan, but only CPU resources are allocated.
Update:
Dbms_resource_manager.update_plan_directive (
Two required parameters,
New_ Property => ' new value ');
Delete:
Dbms_resource_manager.delete_plan_directive (
two required parameters);