Oracle Database Resource Manager (the Resource Manager) enables you to optimize resource allocation among the many concurrent database sessions.
Resource consumer group
A group of sessions that are grouped together based on resource requirements. The Resource Manager allocates resources to resource consumer groups, not to individual sessions.
Resource plan
A container for directives that specify how resources are allocated to resource consumer groups. You specify how the database allocates resources by activating a specific resource plan.
Resource plan directive
Associates a resource consumer group with a particular plan and specifies how resources are to be allocated to that resource consumer group.
Resource Consumer Groups
- SYS_GROUP
- This is the initial consumer group for all sessions created by user accounts SYS or SYSTEM. This initial consumer group can be overridden by session-to–consumer group mapping rules.
- DEFAULT_CONSUMER_GROUP
- This is the initial consumer group for all sessions started by user accounts other than SYS and SYSTEM. This initial consumer group can be overridden by session-to–consumer group mapping rules. DEFAULT_CONSUMER_GROUP cannot be named in a resource plan directive.
- OTHER_GROUPS
- This group applies collectively to all sessions that belong to a consumer group that is not part of the currently active plan, including sessions that belong to DEFAULT_CONSUMER_GROUP. OTHER_GROUPS must have a resource plan directive specified in every plan. It cannot be explicitly assigned to sessions through mapping rules.
Procedure
|
Description
|
GRANT_SYSTEM_PRIVILEGE
|
Grants the ADMINISTER_RESOURCE_MANAGER system privilege to a user or role.
|
REVOKE_SYSTEM_PRIVILEGE
|
Revokes the ADMINISTER_RESOURCE_MANAGER system privilege from a user or role.
|
DBMS_RESOURCE_MANAGER_PRIVS.GRANT_SYSTEM_PRIVILEGE(
GRANTEE_NAME => 'RSMGR,
PRIVILEGE_NAME => 'ADMINISTER_RESOURCE_MANAGER',
ADMIN_OPTION => FALSE);
END;
/
Consumer Group
|
Level 1
|
Level 2
|
Level 3
|
SYS_GROUP
|
100%
|
-
|
-
|
MYGROUP1
|
-
|
80%
|
-
|
MYGROUP2
|
-
|
20%
|
-
|
OTHER_GROUPS
|
-
|
-
|
100%
|
Pending Area
Subprogram
|
Description
|
CALIBRATE_IO Procedure
|
Calibrates the I/O capabilities of storage
|
CLEAR_PENDING_AREA Procedure
|
Clears the work area for the resource manager
|
CREATE_CATEGORY Procedure
|
Creates a new resource consumer group category
|
CREATE_CONSUMER_GROUP Procedure
|
Creates entries which define resource consumer groups
|
CREATE_PENDING_AREA Procedure
|
Creates a work area for changes to resource manager objects
|
CREATE_PLAN Procedure
|
Creates entries which define resource plans
|
CREATE_PLAN_DIRECTIVE Procedure
|
Creates resource plan directives
|
CREATE_SIMPLE_PLAN Procedure
|
Creates a single-level resource plan containing up to eight consumer groups in one step
|
DELETE_CATEGORY Procedure
|
Deletes an existing resource consumer group category
|
DELETE_CONSUMER_GROUP Procedure
|
Deletes entries which define resource consumer groups
|
DELETE_PLAN Procedure
|
Deletes the specified plan as well as all the plan directives it refers to
|
DELETE_PLAN_CASCADE Procedure
|
Deletes the specified plan as well as all its descendants (plan directives, subplans, consumer groups)
|
DELETE_PLAN_DIRECTIVE Procedure
|
Deletes resource plan directives
|
SET_CONSUMER_GROUP_MAPPING Procedure
|
Adds, deletes, or modifies entries for the login and run-time attribute mappings
|
SET_CONSUMER_GROUP_MAPPING_PRI Procedure
|
Creates the session attribute mapping priority list
|
SET_INITIAL_CONSUMER_GROUP Procedure
|
Assigns the initial resource consumer group for a user (Caution: Deprecated Subprogram)
|
SUBMIT_PENDING_AREA Procedure
|
Submits pending changes for the resource manager
|
SWITCH_CONSUMER_GROUP_FOR_SESS Procedure
|
Changes the resource consumer group of a specific session
|
SWITCH_CONSUMER_GROUP_FOR_USER Procedure
|
Changes the resource consumer group for all sessions with a given user name
|
SWITCH_PLAN Procedure
|
Sets the current resource manager plan
|
UPDATE_CATEGORY Procedure
|
Updates an existing resource consumer group category
|
UPDATE_CONSUMER_GROUP Procedure
|
Updates entries which define resource consumer groups
|
UPDATE_PLAN Procedure
|
Updates entries which define resource plans
|
UPDATE_PLAN_DIRECTIVE Procedure
|
Updates resource plan directives
|
VALIDATE_PENDING_AREA Procedure
|
Validates pending changes for the resource manager
|
Parameter
|
Description
|
PLAN
|
Name to assign to the plan.
|
COMMENT
|
Any descriptive comment.
|
CPU_MTH
|
Deprecated. Use MGMT_MTH.
|
ACTIVE_SESS_POOL_MTH
|
Active session pool resource allocation method. ACTIVE_SESS_POOL_ABSOLUTE is the default and only method available.
|
PARALLEL_DEGREE_LIMIT_MTH
|
Resource allocation method for specifying a limit on the degree of parallelism of any operation. PARALLEL_DEGREE_LIMIT_ABSOLUTE is the default and only method available.
|
QUEUEING_MTH
|
Queuing resource allocation method. Controls the order in which queued inactive sessions are removed from the queue and added to the active session pool. FIFO_TIMEOUT is the default and only method available.
|
MGMT_MTH
|
Resource allocation method for specifying how much CPU each consumer group or subplan gets. 'EMPHASIS', the default method, is for single-level or multilevel plans that use percentages to specify how CPU is distributed among consumer groups. 'RATIO' is for single-level plans that use ratios to specify how CPU is distributed.
|
SUB_PLAN
|
If TRUE, the plan cannot be used as the top plan; it can be used as a subplan only. Default is FALSE.
|
PLAN
|
Name of the resource plan to which the directive belongs.
|
GROUP_OR_SUBPLAN
|
Name of the consumer group or subplan to which to allocate resources.
|
COMMENT
|
Any comment.
|
CPU_P1
|
Deprecated. Use MGMT_P1.
|
CPU_P2
|
Deprecated. Use MGMT_P2.
|
CPU_P3
|
Deprecated. Use MGMT_P3.
|
CPU_P4
|
Deprecated. Use MGMT_P4.
|
CPU_P5
|
Deprecated. Use MGMT_P5.
|
CPU_P6
|
Deprecated. Use MGMT_P6.
|
CPU_P7
|
Deprecated. Use MGMT_P7.
|
CPU_P8
|
Deprecated. Use MGMT_P8.
|
ACTIVE_SESS_POOL_P1
|
Specifies the maximum number of concurrently active sessions for a consumer group. Other sessions await execution in an inactive session queue. Default is UNLIMITED.
|
QUEUEING_P1
|
Specifies time (in seconds) after which a session in an inactive session queue (waiting for execution) times out and the call is aborted. Default is UNLIMITED.
|
PARALLEL_DEGREE_LIMIT_P1
|
Specifies a limit on the degree of parallelism for any operation. Default is UNLIMITED.
|
SWITCH_GROUP
|
Specifies the consumer group to which a session is switched if switch criteria are met. If the group name is 'CANCEL_SQL', then the current call is canceled when switch criteria are met. If the group name is 'KILL_SESSION', then the session is killed when switch criteria are met. Default is NULL. If the group name is 'CANCEL_SQL', the SWITCH_FOR_CALL parameter is always set to TRUE, overriding the user-specified setting.
|
SWITCH_TIME
|
Specifies the time (in CPU seconds) that a call can execute before an action is taken. Default is UNLIMITED. The action is specified by SWITCH_GROUP.
|
SWITCH_ESTIMATE
|
If TRUE, the database estimates the execution time of each call, and if estimated execution time exceeds SWITCH_TIME, the session is switched to the SWITCH_GROUP before beginning the call. Default is FALSE. The execution time estimate is obtained from the optimizer. The accuracy of the estimate is dependent on many factors, especially the quality of the optimizer statistics. In general, you should expect statistics to be no more accurate than ± 10 minutes.
|
MAX_EST_EXEC_TIME
|
Specifies the maximum execution time (in CPU seconds) allowed for a call. If the optimizer estimates that a call will take longer than MAX_EST_EXEC_TIME, the call is not allowed to proceed and ORA-07455 is issued. If the optimizer does not provide an estimate, this directive has no effect. Default is UNLIMITED. The accuracy of the estimate is dependent on many factors, especially the quality of the optimizer statistics. In general, you should expect statistics to be no more accurate than ± 10 minutes.
|
UNDO_POOL
|
Sets a maximum in kilobytes (K) on the total amount of undo for uncommitted transactions that can be generated by a consumer group. Default is UNLIMITED.
|
MAX_IDLE_TIME
|
Indicates the maximum session idle time, in seconds. Default is NULL, which implies unlimited.
|
MAX_IDLE_BLOCKER_TIME
|
Indicates the maximum session idle time of a blocking session, in seconds. Default is NULL, which implies unlimited.
|
SWITCH_TIME_IN_CALL
|
Deprecated. Use SWITCH_FOR_CALL.
|
MGMT_P1
|
For a plan with the MGMT_MTH parameter set to EMPHASIS, specifies the CPU percentage to allocate at the first level. For MGMT_MTH set to RATIO, specifies the weight of CPU usage. Default is NULL for all MGMT_Pn parameters.
|
MGMT_P2
|
For EMPHASIS, specifies CPU percentage to allocate at the second level. Not applicable for RATIO.
|
MGMT_P3
|
For EMPHASIS, specifies CPU percentage to allocate at the third level. Not applicable for RATIO.
|
MGMT_P4
|
For EMPHASIS, specifies CPU percentage to allocate at the fourth level. Not applicable for RATIO.
|
MGMT_P5
|
For EMPHASIS, specifies CPU percentage to allocate at the fifth level. Not applicable for RATIO.
|
MGMT_P6
|
For EMPHASIS, specifies CPU percentage to allocate at the sixth level. Not applicable for RATIO.
|
MGMT_P7
|
For EMPHASIS, specifies CPU percentage to allocate at the seventh level. Not applicable for RATIO.
|
MGMT_P8
|
For EMPHASIS, specifies CPU percentage to allocate at the eighth level. Not applicable for RATIO.
|
SWITCH_IO_MEGABYTES
|
Specifies the number of megabytes of I/O that a session can transfer (read and write) before an action is taken. Default is UNLIMITED. The action is specified by SWITCH_GROUP.
|
SWITCH_IO_REQS
|
Specifies the number of I/O requests that a session can execute before an action is taken. Default is UNLIMITED. The action is specified by SWITCH_GROUP.
|
SWITCH_FOR_CALL
|
If TRUE, a session that was automatically switched to another consumer group (according to SWITCH_TIME, SWITCH_IO_MEGABYTES, or SWITCH_IO_REQS) is returned to its original consumer group when the top level call completes. Default is NULL.
|
MAX_UTILIZATION_LIMIT
|
Absolute maximum CPU utilization percentage permitted for the consumer group. This value overrides any level allocations for CPU (MGMT_P1 through MGMT_P8), and also imposes a limit on total CPU utilization when unused allocations are redistributed. You can specify this attribute and leave MGMT_P1 through MGMT_P8 NULL. You cannot specify this attribute for a subplan.
|
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
END;
/
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
/
DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
END;
/
Switching a Single Session
DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS ('17', '12345',
'HIGH_PRIORITY');
END;
/
Switching All Sessions for a User
DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_USER ('SCOTT',
'LOW_GROUP');
END;
/
- Issue the following SQL statement:
- ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = '';
DBMS_RESOURCE_MANAGER.DELETE_PLAN(PLAN => 'SIMPLE');
END;
/
Updating a Resource Plan Directive
DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.UPDATE_PLAN_DIRECTIVE(
PLAN => 'SIMPLE_PLAN1',
GROUP_OR_SUBPLAN => 'MYGROUP1',
NEW_COMMENT => 'Higher priority'
);
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
/
DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
DBMS_RESOURCE_MANAGER.UPDATE_PLAN_DIRECTIVE(
PLAN => 'SIMPLE_PLAN1',
GROUP_OR_SUBPLAN => 'MYGROUP1',
NEW_MAX_EST_EXEC_TIME => -1
);
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
/
View
|
Description
|
DBA_RSRC_CONSUMER_GROUP_PRIVS
USER_RSRC_CONSUMER_GROUP_PRIVS
|
DBA view lists all resource consumer groups and the users and roles to which they have been granted. USER view lists all resource consumer groups granted to the user.
|
DBA_RSRC_CONSUMER_GROUPS
|
Lists all resource consumer groups that exist in the database.
|
DBA_RSRC_MANAGER_SYSTEM_PRIVS
USER_RSRC_MANAGER_SYSTEM_PRIVS
|
DBA view lists all users and roles that have been granted Resource Manager system privileges. USER view lists all the users that are granted system privileges for the DBMS_RESOURCE_MANAGER package.
|
DBA_RSRC_PLAN_DIRECTIVES
|
Lists all resource plan directives that exist in the database.
|
DBA_RSRC_PLANS
|
Lists all resource plans that exist in the database.
|
DBA_RSRC_GROUP_MAPPINGS
|
Lists all of the various mapping pairs for all of the session attributes.
|
DBA_RSRC_MAPPING_PRIORITY
|
Lists the current mapping priority of each attribute.
|
DBA_HIST_RSRC_PLAN
|
Displays historical information about resource plan activation. This view contains AWR snapshots of V$RSRC_PLAN_HISTORY.
|
DBA_HIST_RSRC_CONSUMER_GROUP
|
Displays historical statistical information about consumer groups. This view contains AWR snapshots of V$RSRC_CONS_GROUP_HISTORY.
|
DBA_USERS
USERS_USERS
|
DBA view contains information about all users of the database. It contains the initial resource consumer group for each user. USER view contains information about the current user. It contains the current user's initial resource consumer group.
|
V$ACTIVE_SESS_POOL_MTH
|
Displays all available active session pool resource allocation methods.
|
V$PARALLEL_DEGREE_LIMIT_MTH
|
Displays all available parallel degree limit resource allocation methods.
|
V$QUEUEING_MTH
|
Displays all available queuing resource allocation methods.
|
V$RSRC_CONS_GROUP_HISTORY
|
For each entry in the view V$RSRC_PLAN_HISTORY, contains an entry for each consumer group in the plan showing the cumulative statistics for the consumer group.
|
V$RSRC_CONSUMER_GROUP
|
Displays information about active resource consumer groups. This view can be used for tuning.
|
V$RSRC_CONSUMER_GROUP_CPU_MTH
|
Displays all available CPU resource allocation methods for resource consumer groups.
|
V$RSRCMGRMETRIC
|
Displays a history of resources consumed and cumulative CPU wait time (due to resource management) per consumer group for the past minute.
|
V$RSRCMGRMETRIC_HISTORY
|
Displays a history of resources consumed and cumulative CPU wait time (due to resource management) per consumer group for the past hour on a minute-by-minute basis. If a new resource plan is enabled, the history is cleared.
|
V$RSRC_PLAN
|
Displays the names of all currently active resource plans.
|
V$RSRC_PLAN_CPU_MTH
|
Displays all available CPU resource allocation methods for resource plans.
|
V$RSRC_PLAN_HISTORY
|
Shows when Resource Manager plans were enabled or disabled on the instance. It helps you understand how resources were shared among the consumer groups over time.
|
V$RSRC_SESSION_INFO
|
Displays Resource Manager statistics for each session. Shows how the session has been affected by the Resource Manager. Can be used for tuning.
|
V$SESSION
|
Lists session information for each current session. Specifically, lists the name of the resource consumer group of each current session.
|
Granting the RESOURCE_MANAGER_ADMIN privilege using GRID Control:
- Creating:
- Pending area
- Create consumer groups CRITICAL,MEDIUM,LOW
- Create PLAN - CRITICAL
- Create PLAN directives
- Validate PLAN
- Submit PLAN.
Revoking Switch Privileges
Documentation:
No comments:
Post a Comment