oracle resource manager

22
Oracle Resource Manager Kamus@ACOUG

Upload: leyi-zhang

Post on 13-May-2015

6.145 views

Category:

Technology


8 download

DESCRIPTION

Oracle Resource Manager Training PPT

TRANSCRIPT

Page 1: Oracle Resource Manager

Oracle Resource Manager

Kamus@ACOUG

Page 2: Oracle Resource Manager

About ACOUG

• ACOUG: All China Oracle User Group

• http://acoug.org

Page 3: Oracle Resource Manager

About Me

• 张乐奕 Kamus

• http://www.dbform.com

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

• Oracle & World of Warcraft

Page 4: Oracle Resource Manager

Resource Management

DBA_RSRC_GROUP_MAPPINGS

DBA_RSRC_CONSUMER_GROUPS

DBA_RSRC_PLAN_DIRECTIVES

DBA_RSRC_PLANS

Resource Plan

Element

Resource Plan

Directives

Resource

Consumer Group

Resource

Consumer Group

Resource Plan

Directives

Resource

Consumer Group

Session to Group Mapping

DBA_USERS. INITIAL_RSRC_CONSUMER_GROUP

USERS

Page 5: Oracle Resource Manager

Simple Plan Example

DBA_RSRC_CONSUMER_GROUPS.NAME

DBA_RSRC_PLAN_DIRECTIVES.CPU_P1

DBA_RSRC_PLANS.PLANResource Plan

“DAYTIME”

Directives 115%CPU

Consumer Group

“REPORT1”

Consumer Group

“REPORT2”

Directives 285%CPU

Consumer Group

“OTHER_GROUPS”

Page 6: Oracle Resource Manager

Sub Plan ExampleResource Plan

“TOP”

Directives 115%CPU

Resource Plan“SUB”

Directives 3

70%CPU

Consumer Group“SEVENTY”

Directives 4

20%CPU

Consumer Group“TWENTY”

Directives 5

10%CPU

Consumer Group“OTHER_GROUPS

Directives 285%CPU

Consumer Group“OTHER_GROUPS

Page 7: Oracle Resource Manager

Consumer Group Mappings

TYPEServiceModuleActionOracle UserClient ProgramClient OS UserClient Machine

Consumer Group B

Specific ValuePrio

rities

SYS,SYSTEM …

Specific ValueDEFAULT_CONSUMER_

GROUP

Consumer Group A

Page 8: Oracle Resource Manager

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 with Queuing

ACTIVE_SESS_POOL_P1 Parallel count as one

Degree of Parallelism Limit

PARALLEL_DEGREE_LIMIT_P1

applies to one operation

Execution Time Limit MAX_EST_EXEC_TIME in CPU seconds

Undo Pool UNDO_POOL Kilobytes (K)

Idle Time Limit MAX_IDLE_TIME in seconds

DBA_RSRC_PLAN_DIRECTIVES

Page 9: Oracle Resource Manager

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.

Page 10: Oracle Resource Manager

How to Manage

Use DBMS_RESOURCE_MANAGER

Use EM GUI

Page 11: Oracle Resource Manager

Resource Manager in EM

Plans: Plan and Plan Directives

Page 12: Oracle Resource Manager

Resource Manager by CLI

DBMS_RESOURCE_MANAGER

CREATE|DELETE|UPDATE_PLAN

CREATE|DELETE|UPDATE_PLAN_DIRECTIVE

CREATE|DELETE|UPDATE_CONSUMER_GROUP

SET_CONSUMER_GROUP_MAPPING

Page 13: Oracle Resource Manager

Create Simple Plan

Consumer Group Level 1 Level 2 Level 3

SYS_GROUP 100%

MYGROUP1 80%

MYGROUP2 20%

OTHER_GROUPS 100%

BEGIN DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN (

SIMPLE_PLAN => 'SIMPLE_PLAN1', CONSUMER_GROUP1 => 'MYGROUP1', GROUP1_PERCENT => 80,

CONSUMER_GROUP2 => 'MYGROUP2', GROUP2_PERCENT => 20); END; /

Page 14: Oracle Resource Manager

Create Complex Plan• DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREACreate a Pending Area

• DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP

Create, Modify, Delete a Consumer Group

• DBMS_RESOURCE_MANAGER.CREATE_PLANCreate the Resource

Plan

• DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE

Create the Resource Plan Directives

• DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA

Validate the Pending Area

• DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREASubmit the Pending

Area

Page 15: Oracle Resource Manager

Complex Plan

via Oracle® Database Administrator's Guide11g Release 2 (11.2)

Page 16: Oracle Resource Manager

Complex Plan

Group

CPU Resource Allocation %

Active Session Pool Parameters

Automatic Consumer Group Switching

Maximum Estimated Execution Time

Undo Pool

OLTP Level 1: 80%

  Switch to group: batch Switch time: 3 secs

  200K

BATCH Level 2: 100%

Pool size: 5 Timeout: 600 secs

-- 3600 secs --

OTHER_GROUPS

Level 3: 100%

-- --   --

Page 17: Oracle Resource Manager

PrivilegesBEGIN DBMS_RESOURCE_MANAGER_PRIVS.GRANT_SWITCH_CONSUMER_GROUP ( GRANTEE_NAME => 'KAMUS', CONSUMER_GROUP => 'SYS_GROUP', GRANT_OPTION => TRUE);END;/

BEGIN DBMS_RESOURCE_MANAGER_PRIVS.REVOKE_SWITCH_CONSUMER_GROUP ( REVOKEE_NAME => 'KAMUS', CONSUMER_GROUP => 'SYS_GROUP');END;/

Page 18: Oracle Resource Manager

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';

Page 19: Oracle Resource Manager

Switch Consumer Group

Method Program Comments

Manually

DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS

Switching a Single Session

DBMS_SESSION.SWITCH_CURRENT_CONSUMER_GROUP

Switching a Single Session

DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_USER

Switching All Sessions for a User

Automatic

Automatic Switching with Mapping Rules

Session attribute changes while the session is running

Automatic Switching by Setting Resource Limits

Defined in resource plan directive

Page 20: Oracle Resource Manager

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_*

Page 21: Oracle Resource Manager

Oracle ScheduleKamus@ACOUG

Page 22: Oracle Resource Manager

Automated Maintenance Tasks

Scheduler Windows

Resource Plan

DEFAULT_MAINTENANCE_PL

AN

DBMS_SCHEDULER.CREATE_WINDO

W