Вы находитесь на странице: 1из 22

Oracle

Resource
Manager
 Kamus@ACOUG
About ACOUG
• ACOUG: All China Oracle User Group

• http://acoug.org


About Me
• 张乐奕 Kamus

• http://www.dbform.com

• Oracle -> 恩墨科技 (http://www.enmou.com)

• Oracle & World of Warcraft



Resource Management

USERS

DBA_USERS.
INITIAL_RSRC_CONSUMER_GROUP
Simple Plan Example
Sub Plan Example
Consumer Group Mappings
TYPE
Service
Module Spec
ific V
Action alue Consumer
Oracle User Group A
Client Program
Priorities

Client OS User SYS,SYSTEM … Consumer


Client Machine Group B

a l u e DEFAULT_CO
f ic V NSUMER_GR
pe c i
S OUP
Resource Allocation Methods
Methods Columns Comments
CPU MGMT_Pn (CPU_Pn) Up to 8 levels
Max Utilization Limit MAX_UTILIZATION_LIMIT Up to 8 levels
Active Session Pool ACTIVE_SESS_POOL_P1 Parallel count as
with
DegreeQueuing
of Parallelism PARALLEL_DEGREE_LIMIT_P1 one
applies to one
Limit
Execution Time Limit MAX_EST_EXEC_TIME operation
in CPU seconds
Undo Pool UNDO_POOL Kilobytes (K)
Idle Time Limit MAX_IDLE_TIME in seconds

DBA_RSRC_PLAN_DIRECTIVES
Notes
• The currently active resource plan does not enforce allocation 
limits until CPU usage is at 100%.

• When limits are enforced, unused allocation by any consumer 
group can be used by other consumer groups

• It is possible for a subplan or consumer group to have more 
than one parent.

• No more than 31 resource consumer groups in any active 
plan

• At most, a plan can have 31 children

• Plans and resource consumer groups cannot have the same 
name.


How to Manage

Use DBMS_RESOURCE_MANAGER

Use EM GUI
Resource Manager in EM

Plans: Plan and Plan Directives


Resource Manager by CLI
Create Simple Plan
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN (
SIMPLE_PLAN => 'SIMPLE_PLAN1',
CONSUMER_GROUP1 => 'MYGROUP1', GROUP1_PERCENT
=> 80,
CONSUMER_GROUP2 => 'MYGROUP2',
GROUP2_PERCENT => 20);
END; /

Consumer Group Level 1 Level 2 Level 3


SYS_GROUP 100%
MYGROUP1 80%
MYGROUP2 20%
OTHER_GROUPS 100%
Create Complex Plan
Complex Plan

via Oracle® Database Administrator's Guide


11g Release 2 (11.2)
Complex Plan
Group CPU Resource Active Session Automatic Maximum Undo Pool
OLTP Allocation %
Level 1: 80% Pool Consumer
Switch to Estimated 200K
BATCH Level 2: 100% Parameters
Pool size: 5 Group
group:
-- batch Execution
3600 secs Time --
Timeout: 600 Switching
Switch time: 3
OTHER_GRO Level 3: 100% -- -- --
UPS secs secs
Privileges
BEGIN
DBMS_RESOURCE_MANAGER_PRIVS.GRANT_SWITCH_CONSUME
R_GROUP (
 GRANTEE_NAME => 'KAMUS',
 CONSUMER_GROUP => 'SYS_GROUP',
 GRANT_OPTION => TRUE);
END;

/

BEGIN
DBMS_RESOURCE_MANAGER_PRIVS.REVOKE_SWITCH_CONSUM
ER_GROUP (
 REVOKEE_NAME => 'KAMUS',
 CONSUMER_GROUP => 'SYS_GROUP');
END;

/


How to Enable/Disiable
Manually
By default the Resource Manager is not enabled

ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = 
'mydb_plan';

DBMS_RESOURCE_MANAGER.SWITCH_PLAN

By using Scheduler Windows
Enable: By Oracle Scheduler

Disable: ALTER SYSTEM SET 
RESOURCE_MANAGER_PLAN = 'FORCE:mydb_plan';
Switch Consumer Group
Method Program Comments
DBMS_RESOURCE_MANAGER.SWIT Switching a Single
CH_CONSUMER_GROUP_FOR_SESS Switching
Manually DBMS_SESSION.SWITCH_CURRENT Session a Single
_CONSUMER_GROUP
DBMS_RESOURCE_MANAGER.SWIT Switching
Session All Sessions
CH_CONSUMER_GROUP_FOR_USER
Automatic Switching with Mapping Session attribute
for a User
Automatic Automatic
Rules Switching by Setting Defined in resource
changes while the
Resource Limits plan directive
session is running
Views about RSRC
• DBA_RSRC_CONSUMER_GROUP_PRIVS

• DBA_RSRC_PLANS

• V$RSRC_PLAN

• V$RSRC_CONSUMER_GROUP

• V$SESSION. RESOURCE_CONSUMER_GROUP

• V$RSRC_SESSION_INFO

• DBA_HIST_RSRC_*
Oracle Schedule
Kamus@ACOUG
Automated Maintenance Tasks

Scheduler Windows

DBMS_SCHEDULER.C
REATE_WINDOW

Resource Plan
DEFAULT_MAINTENANCE_PLA

Вам также может понравиться