Managing Resources
Copyright © 2006, Oracle. All rights reserved.
Objectives
> Concepts
Resource Plan
Consumer Group
Plan Directives
Mapping
Plan activation
Monitoring
After completing this lesson, you should be able to do
the following:
• Configure the Database Resource Manager
• Access and create resource plans
• Create consumer groups
• Specify directives for allocating resources to
consumer groups
• Map consumer groups to plans
• Activate a resource plan
• Monitor the Resource Manager
13-2
Copyright © 2006, Oracle. All rights reserved.
Database Resource Manager: Overview
Use the Resource Manager to:
• Manage mixed workload
• Control system performance
Database
Resource Manager
OLTP users
DSS users
More resources
Fewer resources
Batch users
Least resources
13-3
Copyright © 2006, Oracle. All rights reserved.
Oracle
database
Database Resource Manager Concepts
User groups or sessions
with similar resource
needs
Resource
consumer
group
Resource plan
Resource plan
directives
13-4
A blueprint for resource
allocation among
resource consumer
groups (one active plan)
Specifies how a resource
is divided among the
resource consumer
groups (within the scope
of allocation methods)
Copyright © 2006, Oracle. All rights reserved.
Why Use Resource Manager
•
You can manage database and operating system
resources, such as:
–
–
–
–
–
–
•
13-5
CPU usage
Degree of parallelism
Number of active sessions
Undo generation
Operation execution time
Idle time
You can also specify criteria that, if met, cause the
automatic switching of sessions to another
consumer group.
Copyright © 2006, Oracle. All rights reserved.
Example: SYSTEM_PLAN
13-8
Resource Consumer
Group
Allocation Methods
CPU_P1
CPU_P2
CPU_P3
SYS_GROUP
100%
0%
0%
OTHER_GROUPS
0%
100%
0%
LOW_GROUP
0%
0%
100%
Copyright © 2006, Oracle. All rights reserved.
Creating a New Resource Plan
DBMS_RESOURCE_MANAGER.SWITCH_PLAN
(PLAN_NAME => 'DAY_PLAN',
SID => 'ORCL',
ALLOW_SCHEDULER_PLAN_SWITCHES => true );
13-9
Copyright © 2006, Oracle. All rights reserved.
Creating Consumer Groups
Concepts
Resource Plan
> Consumer Group
.
Plan
Directives
Mapping
Plan activation
Monitoring
DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(
CONSUMER_GROUP => 'APPUSER',
CPU_MTH => 'ROUND-ROBIN',
COMMENT => '');
13-10
Copyright © 2006, Oracle. All rights reserved.
Assigning Users to Consumer Groups
13-11
Copyright © 2006, Oracle. All rights reserved.
Specifying Resource
Plan Directives
1
2
3
4
5
6
CPU_MTH values
13-12
Copyright © 2006, Oracle. All rights reserved.
Concepts
Resource Plan
Consumer Group
> Plan Directives
Mapping
Plan activation
Monitoring
7
Resource Allocation Methods for Resource
Plans
Parameter
Possible Values
CPU_MTH
EMPHASIS
RATIO
13-13
PARALLEL_DEGREE_LIMIT_MTH
PARALLEL_DEGREE_
LIMIT_ABSOLUTE
ACTIVE_SESS_POOL_MTH
ACTIVE_SESS_POOL
_ABSOLUTE
QUEUING_MTH
FIFO_TIMEOUT
Copyright © 2006, Oracle. All rights reserved.
Comparison of EMPHASIS and RATIO
13-14
EMPHASIS
RATIO
The value specifies the
maximum percentage of CPU
resources a consumer group
can use.
The value specifies a number that
indicates the ratio of CPU
resources to be allocated to the
consumer group.
You can allocate resources
for up to 8 different levels.
You can specify values for only one
level.
The sum of percentages at
any given level must be less
than or equal to 100.
You must use integer values, but
there is no limit on the sum of
values.
Default value is NULL.
Default value is NULL.
Copyright © 2006, Oracle. All rights reserved.
Directive
Tab 3
Active Session Pool Mechanism
Sess4
Sess5
p001
p002
p003
Sess10
Sess3
Sess8
Sess9
Sess1
13-16
Sess2
Sess6
Sess7
OLTP users
DSS users
Active_sess_pool_P1=5
Active_sess_pool_P1=3
Copyright © 2006, Oracle. All rights reserved.
DSS
active
session
queue
Setting the Active Session Pool
13-17
Copyright © 2006, Oracle. All rights reserved.
Directive
Tab 5
•
•
•
•
•
13-18
Maximum Estimated Execution Time
The Database Resource Manager can estimate the
execution time of an operation proactively.
You can specify a maximum estimated execution
time for an operation at the resource consumer
group level.
Operation does not start if the estimate is longer
than MAX_EST_EXEC_TIME. (ORA-07455)
The benefit of this feature is the elimination of the
exceptionally large job that uses too many system
resources.
The default is UNLIMITED.
Copyright © 2006, Oracle. All rights reserved.
Directive
Tab 6
Consumer Group Switching
xx
13-19
Copyright © 2006, Oracle. All rights reserved.
Switching Back to the Initial Consumer
Group at the End of Call
13-20
Copyright © 2006, Oracle. All rights reserved.
Switching Back to the Initial Consumer
Group at the End of Call
Call 1
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE
(PLAN => 'Day_Plan',
GROUP_OR_SUBPLAN => 'DSS_GROUP',
CPU_P1 => 100, CPU_P2 =>
0,
SWITCH_GROUP => 'LONGRUN_GROUP',
SWITCH_TIME_IN_CALL => 600);
Call 2
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE
(PLAN => 'Day_Plan',
GROUP_OR_SUBPLAN => 'LONGRUN_GROUP',
CPU_P1 =>
0, CPU_P2 => 100);
At call end
13-21
Copyright © 2006, Oracle. All rights reserved.
Directive
Tab 7
Setting Idle Timeouts
DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE
(PLAN => 'DAY_PLAN',
GROUP_OR_SUBPLAN => 'DSS_GROUP',
COMMENT => 'Limit Idle Time Example',
MAX_IDLE_TIME => 600,
MAX_IDLE_BLOCKER_TIME => 300);
13-22
Copyright © 2006, Oracle. All rights reserved.
Resource Consumer
Group Mapping
13-23
Copyright © 2006, Oracle. All rights reserved.
Concepts
Resource Plan
Consumer Group
Plan Directives
> Mapping
Plan activation
Monitoring
Concepts
Resource Plan
Consumer Group
Plan Directives
Mapping
> Plan activation
Monitoring
Activating a Resource Plan .
for an Instance
13-25
Copyright © 2006, Oracle. All rights reserved.
Database Resource Manager Information
13-26
View Name
Information
DBA_RSRC_PLANS
Plans and status
DBA_RSRC_PLAN_DIRECTIVES
Plan directives
DBA_RSRC_CONSUMER_GROUPS
Consumer groups
DBA_RSRC_CONSUMER_GROUP_PRIVS
Users/roles
DBA_RSRC_GROUP_MAPPINGS
Consumer group
mapping
DBA_RSRC_MAPPING_PRIORITY
Mapping priority
DBA_USERS
Column
initial_rsrc_
consumer_group
DBA_RSRC_MANAGER_SYSTEM_PRIVS
Users/roles
Copyright © 2006, Oracle. All rights reserved.
Monitoring the
Resource Manager
13-27
Copyright © 2006, Oracle. All rights reserved.
Concepts
Resource Plan
Consumer Group
Plan Directives
Mapping
Plan activation
> Monitoring
Monitoring the Resource Manager
•
V$SESSION: Contains the
resource_consumer_group column that
•
•
13-28
shows the current group for a session
V$RSRC_PLAN: A view that shows the active
resource plan
V$RSRC_CONSUMER_GROUP: A view that contains
statistics for all active groups
Copyright © 2006, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to do the
following:
• Configure the Database Resource Manager
• Access and create resource plans
• Create consumer groups
• Specify directives for allocating resources to
consumer groups
• Map consumer groups to plans
• Activate a resource plan
• Monitor the Resource Manager
13-30
Copyright © 2006, Oracle. All rights reserved.
Practice Overview:
Using the Resource Manager
This practice covers the following topics:
• Creating a resource consumer group
• Specifying CPU resource allocation directives for
consumer groups
• Associating users with a resource consumer
group
• Activating a resource plan
• Testing in SQL*Plus
• Deactivating a resource plan
13-31
Copyright © 2006, Oracle. All rights reserved.