You are on page 1of 41

Upcoming: Advisor Webcast: Oracle Database Resource Manager

Upcoming Advisor Webcast Schedule

Check out Note ID : 740966.1

Select your Product Area

Scan through the list of Current Topics

Register for the session of your interest

Upcoming: Advisor Webcast: Oracle Database Resource Manager


Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 2
ATTENTION AUDIO Options
Option 1: Voice Streaming Audio Broadcast Option 2: Teleconference (Dial In)
No need to dial in on a telephone Requires telephone to dial in
Questions can be asked in the WebEx Q&A panel Questions can be asked over the phone or in the
WebEx Chat
Details
Conference ID: 85999183
International dial in: +44 (0) 1452 562 665
US Free call: 1866 230 1938
List with national toll free numbers is available
in Doc ID: 1148600.1
View anytime during the conference using
Communicate > Teleconference > Join
Teleconference from your WebEx menu

Upcoming: Advisor Webcast: Oracle Database Resource Manager


Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 3
Oracle Advisor Webcast
Oracle Database Resource Manager
Neelima Pitta
Senior Software Engineer

April 30, 2015

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 4


Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracles products remains at the sole discretion of Oracle.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 5


Oracle Advisor Webcast
Oracle Database Resource Manager
Neelima Pitta
Senior Software Engineer

April 30, 2015

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 6


Objectives
Understanding Resource Manager

Creating Resource Plans

Using RM plans to limit resources

Predefined RM plans

Waits due to Resource Manager

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 7


Agenda
1 Benefits
2 Elements
3 Simple and Complex plan
4 Examples to limit resources
5 Predefined Plans
6 Resmgr:cpu quantum wait
7 Monitoring
8 Usage in 12c
9 Instance caging and interaction with OS Resource Manager

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 8


What is Resource Manager

A resource management mechanism that controls how system resources


(such as CPU) are allocated in the database.

Benefits:
Distribute CPU as per priority.
Limit degree of parallelism, active sessions, undo usage.
Manage multiple workload environment.
Control idle/inactive sessions.
Handle runaway queries.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 9


Elements of Resource Manager
Resource Consumer Group
A group of sessions that have similar resource requirements.

Resource Plan
A collection of rules or directives that specifies how resources are allocated to
consumer groups.

Resource Plan directive


Maps resource manager plan to consumer group and specifies how resources are
distributed.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Elements of Resource Manager Contd..

Resource Consumer Group


A collection of sessions (and not users) that are grouped together based on business
requirements.
Predefined Consumer Groups examples:
SYS_GROUP : Sessions created by SYS or SYSTEM user.
OTHER_GROUPS : Contains all sessions that have not been assigned to any consumer group. Must
exist for any RM plan.
Created using DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP.
Mapped using SET_CONSUMER_GROUP_MAPPING.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Elements of Resource Manager Contd..
Consumer groups are mapped to sessions based on below attributes:
Oracle_user
Service_name

Client_os_user
Client_program
Client_machine
Client_id

Module_name
Module_name_action
Service_module
Service_module_action

Oracle_function (dataload, backup, and copy)

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Elements of Resource Manager Contd..
Resource Plan
By default, database has no resource manager plan.
Enabled by setting RESOURCE_MANAGER_PLAN parameter.
Only one plan can be active per instance at a time. RAC databases can have different RM
plan active on each instance.
Resource plans impose only soft limits, limits can exceed if resources are available. Hard
limits can be imposed by setting max_utilization_limit.
CPU distribution happens only when database CPU utilization reaches 100% .
Subplans i.e plan within plans can be created for more granular management.
Resource manager plans can be associated with scheduler windows or jobs.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Elements of Resource Manager Contd..
Resource Plan directive
Used to specify how resources are allocated to consumer groups. Each directive can
specify multiple methods for allocating resources.
Allocation methods (directives) available:

CPU
Degree of Parallelism Limit
Parallel Target Percentage
Parallel Queue Timeout
Active Session Pool with Queuing
Undo Pool
Idle Time Limit
Automatic Consumer Group Switching
Canceling SQL and Terminating Sessions

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Creating Resource Manager Plan
Grant privileges to administer Oracle Resource Manager
(DBMS_RESOURCE_MANAGER_PRIVS.GRANT_SYSTEM_PRIVILEGE)
Create a Simple or a Complex Resource Plan
Map Consumer Groups for sessions
(DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING )
Grant switch privilege for resource consumer groups
(DBMS_RESOURCE_MANAGER_PRIVS.GRANT_SWITCH_CONSUMER_GROUP)
Enable the Resource Plan ( RESOURCE_MANAGER_PLAN)

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Simple Resource Plan
Can be created using CREATE_SIMPLE_PLAN procedure.
Only CPU allocation supported.
Up to eight consumer groups can be specified.

Example:
SQL> BEGIN
DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN(SIMPLE_PLAN =>
'EXAMPLE_SIMPLE_PLAN',
CONSUMER_GROUP1 => 'HIGH_PRIORITY',GROUP1_PERCENT => 70,
CONSUMER_GROUP2 => 'LOW_PRIORITY',GROUP2_PERCENT => 30);
END;
/

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Complex Resource Plan
Create Resource Plan
Create DB users
Directives

Map Sessions to
Administer RM privilege
Consumer Groups

Create Pending Area Validate Pending Area

Create Resource
Submit Pending Area
Consumer Groups

Grant switch privileges


Create Resource Plan
to Consumer Groups

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Demonstration

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 18


Understanding Resource Allocation

Consumer Group Level1 CPU Level2 CPU Level3 CPU Maximum Utilization Limit

HIGH_PRIORITY 80% - -

MEDIUM_PRIORITY 20% - - 40%

LOW_PRIORITY - 80% -

OTHER_GROUPS - - 100%

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Understanding Resource Allocation Contd

PRIORITY_BASED_PLAN

HIGH_PRIORITY MEDIUM_PRIORITY LOW_PRIORITY


60% CPU 30% CPU 10% CPU

IMP_USERS SMALL_USERS
80% CPU 20% CPU

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Examples to limit resources using RM
CPU allocation in single level plan
Plan Description Directives
H_user: MGMT_P1 => 60
Testing CPU allocation
Single_level_cpu_plan M_user: MGMT_P1 => 30
for Single Level Plan.
L_user: MGMT_P1 => 10

Execution Time Limit


Plan Description Directives
Switch consumer group for SWITCH_TIME => 120
Switch_time_plan M_USER to L_USER if M_USER SWITCH_GROUP => L_USER
runs for > 120 CPU seconds.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Maximum Idle Time for sessions
Plan Description Directives
Testing connection time
Idle_time_plan out for sessions based MAX_IDLE_IME => 180
on idle time.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Demonstration

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 23


Predefined Resource manager plans
DEFAULT_MAINTENANCE_PLAN
Automatically enabled when MAINTENANCE_WINDOW_GROUP opens.
Automated maintenance tasks are executed : Automatic Optimizer Statistics
Collection, Automatic Segment Advisor, Automatic SQL Tuning Advisor
Resource Allocation:
Consumer Group/subplan Level 1 Level 2 Maximum Utilization Limit

ORA$AUTOTASK_SUB_PLAN - 25% 90

ORA$DIAGNOSTICS - 5% 90

OTHER_GROUPS 75% 70%

SYS_GROUP -

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 24


Resmgr:cpu quantum waits
Resource manager runs one process per CPU at a time.
Lower priority processes wait on an internal queue with wait event
resmgr:cpu quantum.
Expected wait when CPU maxed out.
To reduce the wait:
Tune resource plan and allocations.
Or add more CPUs.
Or this could be a bug (Doc ID 1339803.1) .
When database has no resource manager running, waits are possible
during maintenance windows due to DEFAULT_MAINTENANCE_PLAN.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 25


Monitoring
V$RSRC_PLAN
Displays currently active resource plan and its subplans.

V$RSRC_SESSION_INFO
Monitor sessions

V$RSRCMGRMETRIC
Provides real time metrics to track sessions in terms of CPU utilization etc.

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 26


V$RSRC_PLAN
V$RSRC_CONSUMER_GROUP
V$RSRC_SESSION_INFO
V$RSRC_PLAN_HISTORY
V$RSRC_CONS_GROUP_HISTORY
V$RSRCMGRMETRIC
V$RSRCMGRMETRIC_HISTORY
DBA_RSRC_PLANS
DBA_RSRC_CONSUMER_GROUPS
DBA_RSRC_CATEGORIES
DBA_RSRC_PLAN_DIRECTIVES
DBA_RSRC_CONSUMER_GROUP_PRIVS
DBA_RSRC_MANAGER_SYSTEM_PRIVS
DBA_RSRC_GROUP_MAPPINGS
DBA_RSRC_MAPPING_PRIORITY
DBA_RSRC_STORAGE_POOL_MAPPING
DBA_RSRC_CAPABILITY
DBA_RSRC_INSTANCE_CAPABILITY
DBA_RSRC_IO_CALIBRATE
DBA_HIST_RSRC_CONSUMER_GROUP
DBA_HIST_RSRC_PLAN

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 27


Resource Manager in 12c
CDB level - Resource Manager limits resource utilization of specific PDBs.
Resources controlled are: CPU and Parallel execution servers.
Shares, utilization_limit, parallel_server_limit of procedure
CREATE_CDB_PLAN_DIRECTIVE are used to limit resource allocation to
PDBs.
PDB level - Resource Manager manages workloads within each PDB.
Created using CREATE_PLAN_DIRECTIVE.
A PDB resource plan cannot have subplans.
A PDB resource plan can have a maximum of eight consumer groups.
Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 28
Resource Manager in 12c Contd

CDB Resource Plan in root

Directive Directive Directive


Share = 3 Share = 2 Share = 1
utilization_limit = 100 utilization_limit = 100 utilization_limit = 80
parallel_server_limit = 100 parallel_server_limit = 100 parallel_server_limit = 80

PDB1 PDB2 PDB3

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Instance caging and interaction with OS Resource Manager
Instance Caging
Enabled using cpu_count parameter.
Used to limit CPU consumption on a multi CPU server.
Over- provisioning : Sum of CPUs for all instances exceeds actual CPUs on the server.
Partitioning: Sum of CPUs is equal to actual number of CPUs server.
Interaction with OS Resource Manager
Need careful planning for running Oracle RM and OS RM together.
If OS is rapidly changing resources allocated, then database RM might not keep up.
Process priority management must not be enabled

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 30


Summary
What we covered today
Resource Manager Concepts
Consumer groups, RM plans, directives
Creating resource manager plans
Simple and Complex
Limiting resource allocation
Predefined plans, RM waits

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 31


Q&A
To ask a question on the phone
line, select *1 on your phone.
To ask a question online, use the
Q&A area at the top.
Your question will be read aloud in
the order received.
Question can also be asked on the
My Oracle Support Communities

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 32


Top Articles and Community Links
Include any specific links to relevant KM
articles here.

Include a link to pre-defined Q&A thread in


the appropriate KM Community The
following thread will have a copy of the
presentation and can be used for additional
questions or discussions on this topic.
(POST THREAD)

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 33


Question and Answer Instructions

Q&A panel

3
Send your question
2
Ask: ALL PANELLIST leave default!

1
type your question here

Copyright 2015 Oracle and/or its affiliates. All rights reserved. |


Oracle Advisor Webcast Program
Locating Current Schedule & Archived Recordings

From Note ID : 740966.1 drill


down to your area of interest

Select your Product Area

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 35


Oracle Advisor Webcast Program
Locating Current Schedule & Archived Recordings For DB

Note:
Click column headings to sort
Hover on Webcast Title for more
information
Recordings available within 48
hours
Advisor Webcast Questions on a
webcast or ask questions via the
Questions? link

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 36


Learn More
Available References and Resources to Get Proactive

My Oracle Support Essentials Webcast Series


https://support. oracle.com | Doc ID: 553747.1

My Oracle Support Blog


https://blogs.oracle.com/supportportal/

Get Proactive in My Oracle Support


https://support. oracle.com | Doc ID: 432.1

Ask the Get Proactive Team


get-proactive_ww@oracle.com

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 37


Accessing My Oracle Support Community
1. Via My Oracle Support -> Community Tab 2. Directly https://communities.oracle.com

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 38


Where Can I Get Slides and Recording From This Session?
1. PDF link and recording link from Doc ID 740966.1 (within 48 hours)
2. Oracle Database > Database Administration > Content Tab > Documents
(within 24 hours)

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 39


Session Related Community Links

The following thread will have a copy


of the presentation and can be used
for additional questions or discussions
on this topic.

https://community.oracle.com/thread/
3699418

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 40


THANK YOU

Copyright 2015 Oracle and/or its affiliates. All rights reserved. | 41

You might also like