Oracle之Database Resource Manager和Database resource group

1. What is the Database Resource Manager

2. What is the role of database resource manager?

3, how to create a database resource manger

4. What database resource manager application scene?

First, the basic concept

The Simple View Of Resource Plan



. Resource Consumer Group  (resource user groups)
A Group of Sessions that are Grouped Together based ON Resource requirements. At The Resource Manager allocates Resources to Resource Consumer Groups, not to Individual Sessions.
Explorer will be unified allocation of resources to resource user groups, rather than on a specific session, when the session is established will be mapped according to their attributes to different groups of users, and from the application of system resources

. resource plan  (ERP)
a Container for directives that the Specify How resources are allocated to resource consumer groups. You specify how the database allocates resources by activating a specific resource plan.
a database can have multiple Resource Plan , but the same time only one state to the Active Plan (determined by the initialization parameter resource_manager_plan), associated with a plurality of Resource Directive plan

. resource plan Directive  (Directive resource planning)
Associates a resource consumer group with a particular plan and specifies how resources are to be allocated to that resource consumer group.
Create a program instruction after the system determines resource allocation of resources to a user group

Second, how to create a resource plan

Pending the Create Area 1.

All Changes to the MUST BE DONE at The Schema Plan A the WITHIN the Pending Area. The Pending Area at The CAN BE AS A by Thought of "Scratch" Area Plan for Schema Changes.
All About Resource Manager component creates and changes are necessary in the Pending Area completed , the document says can be understood as a "scratch area"

SQL> Exec DBMS_RESOURCE_MANAGER. CREATE_PENDING_AREA

PL / SQL Procedure completed successfully.

2. the create a resource. Planing

when creating a resource plan needs to note is that if sub_plan parameter to specify is TRUE, then this Program only as a sub-program , and do not need to create plan Directive OTHER_GROUPS

the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.CREATE_PLAN (
  . 3 plan => 'PLAN1',
  . 4 Comment => 'the Test plan ...',
  . 5  sub_plan => FALSE) ; - is the default value FALSE
  . 6 the END;
  7 /

PL / SQL Procedure Completed successfully.

3. the Create Consumer Groups

to create user groups according to the actual needs required, should be noted that although this step has not created OTHER_GROUPS user group, but behind the Plan must be created corresponding to the user group OTHER_GROUPS Directive

the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
  . 3 consumer_group => 'GROUP_OLTP',
  . 4 Comment => 'group of the uSERS OLTP ...',
  . 5  mgmt_mth => 'the ROUND-ROBIN'); - the user group for each session CPU resources allocation polling method adopted
  . 6 the END;
  . 7 /

. PL / Procedure successfully Completed the SQL

the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP (
  . 3 consumer_group => 'GROUP_OLAP',
  . 4 Comment => 'Group of the OLAP the USERS ...' ,
  . 5 mgmt_mth => 'the ROUND-ROBIN');
  6 END;
  7 /
PL / Completed the SQL Procedure successfully.

4. Consumer the To the Map Groups Sessions

mapping relationship between the user session and resource groups according to the login session and the run attribute may be used by the process SET_INITIAL_CONSUMER_GROUP "Username" user sets the initial user resource groups, the process after 11gR1 was abandoned, to use SET_CONSUMER_GROUP_MAPPING to map user groups "Session Attribute".
Here's session attributes include: oracle_user, client_os_user, client_program, client_machine , module_name ...
when multiple sessions attribute mapping conflicts will be decided according to the priority of each attribute final mapping relationship, use this procedure to adjust the priority attributes: SET_CONSUMER_GROUP_MAPPING_PRI

the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING (
  . 3 = attribute> 'CLIENT_MACHINE',
  . 4 value => 'the ASM', - from "ASM" client initiated session mapped to "GROUP_OLAP" user group
  5 = consumer_group> 'GROUP_OLAP');
  . 6 the END;
  . 7 /

PL / Completed the SQL Procedure successfully.


  DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING 2 (
  . 3 = attribute> 'CLIENT_MACHINE',
  . 4 value => 'WORKGROUP \ XIAO', - from "WORKGROUP \ XIAO" client initiated session mapped to "GROUP_OLTP" user group
  5 consumer_group => 'GROUP_OLTP ');
  . 6 the END;
  . 7 /

. PL / successfully Completed the SQL Procedure

5. the Directives the Create the resource plan

create resource planning instruction for each user is mapped to the group session, the control can be seen as the core database resource management.

Here resource type can be controlled more:
A.CPU use,
B the maximum number of active sessions,.
C session parallelism,.
D session maximum idle time,.
E.Undo size using


the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
  . 3 Plan => 'PLAN1', - Plan Directive to the associated PLAN "Plan1"
  4 group_or_subplan => 'GROUP_OLAP', - can specify a user group can be specified Sub Plan, and constitutes a unique parameter on the properties of the Plan Diretive
  . 5 Comment => 'Directives for the OLAP Consumer Group ...',
  . 6 Active_sess_pool_P1 = > 5, - the maximum number of active sessions, that limit is reached after the other into the session Queue Inactive session
  . 7 queueing_p1 => 10, - waiting Queue in Inactive session timeout
  8 parallel_degree_limit_p1 => 2, - maximum parallelism
  9 switch_group = > 'KILL_SESSION', - after a specified condition is met, the operation of the session taken
10 switch_time => 3, - the execution time limit, the operation execution time exceeds the session value, i.e., take on the operation step (second )
. 11 switch_estimate => FALSE, - If set to TRUE, the first operation performed prior to the estimated execution time Oracle order to determine whether to switch the user group
12 max_est_exec_time => 5, - estimating the maximum execution time, the operation time optimizer estimate, and if it exceeds this value directly returns "ORA-07455"
13 is UNDO_POOL => NULL, --uncommited Use the undo Segments limit (KB)
14 MAX_IDLE_TIME => 300, - the maximum idle time of the session
15 max_idle_blocker_time => 3, the maximum idle time --Blocker session
16 mgmt_p1 => 30, --CPU usage restrictions (Level. 1)
. 17 mgmt_p2 => 0); - CPU use limit (Level 2)
18 is the END;
. 19 /

. PL / Procedure successfully Completed the SQL

the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
  . 3 Plan => 'PLAN1',
  4 group_or_subplan => 'GROUP_OLTP', - creation instruction is "GROUP_OLTP" user group plan
  . 5 Comment => 'Directives for OLTP Consumer Group ...',
  . 6 Active_sess_pool_P1 => 10,
  . 7 switch_group => 'CANCEL_SQL',
  . 8 SWITCH_TIME =>. 3, MAX_IDLE_TIME =>. 3,
  . 9 mgmt_p1 => 60,
10 mgmt_p2 => 0);
. 11 the END;
12 is /

. PL / Procedure successfully Completed the SQL

the SQL> the BEGIN
  2 DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE (
  . 3 Plan => 'PLAN1',
  4 group_or_subplan => 'OTHER_GROUPS', - Create Plan Directive is not mapped to more than one user in the group session
  . 5 Comment => 'the OTHER Directives for users group ...',
  . 6 parallel_degree_limit_p1 =>. 1,
  7 mgmt_p1 => 0,
  8 mgmt_p2 => 100); --CPU use restriction (100% Level 2, i.e., Level 1% allocated the remaining 10)
  . 9 the END;
10 /

PL / Completed the SQL Procedure successfully.

6. The the Validate the Submit the Resource Plan &

Out of Creating and Changing resource management elements to perform after the completion of check and submit, if logical error occurs will lead to error, such as:
  no Plan Directive OTHER_GROUPS defined user group
  . mgmt_p1 in a Plan or Plan Directive mgmt_p2 of each is greater than 100% and some other error

the SQL> DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA Exec ()

PL / Completed the SQL Procedure successfully.

the SQL> DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA Exec ()

PL / Completed the SQL Procedure successfully.

7. the Database view the Resource Manager of the Elements

via dynamic performance views and data dictionary view, it can be viewed by EM graphical interface

Consumer Groups:


Consumer Groups Mapping:


Resource Plan Directives:


So far, the resource management plan has been created, modify the initialization parameters resource_manager_plan to enable the new resource management plan, or the state of the program directly in the EM console changed to "Active"

attached (dynamic performance views and data dictionary)
DBA_RSRC_CATEGORIES
DBA_RSRC_CONSUMER_GROUP_PRIVS
DBA_RSRC_CONSUMER_GROUPS
DBA_RSRC_GROUP_MAPPINGS
DBA_RSRC_IO_CALIBRATE
DBA_RSRC_MANAGER_SYSTEM_PRIVS
DBA_RSRC_MAPPING_PRIORITY
DBA_RSRC_PLAN_DIRECTIVES
DBA_RSRC_PLANS
V $ RSRC_CONS_GROUP_HISTORY
V $ RSRC_CONSUMER_GROUP
V $ RSRC_CONSUMER_GROUP_CPU_MTH
V $ RSRC_PLAN
V $ RSRC_PLAN_CPU_MTH
V $ RSRC_PLAN_HISTORY
V $ RSRC_SESSION_INFO
V $ RSRCMGRMETRIC
V $ RSRCMGRMETRIC_HISTORY 

2, close the database DRM function.

A, Scheme 1: completely closed modify parameters _gc_policy_time = 0, but the need to restart the database.

Guess you like

Origin www.cnblogs.com/dayu-liu/p/11073678.html