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

Document 1358709.

1 of 3

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-stat...

Configuring Resource Manager for Mixed Workloads in a Database (Doc ID 1358709.1)

APPLIES TO:
Oracle Exadata Storage Server Software - Version 11.2.1.2.0 and later
Oracle Database - Enterprise Edition - Version 11.2.0.0 and later
Information in this document applies to any platform.
***Checked for relevance on 24-Oct-2013***

PURPOSE
The purpose of this document is to provide a step-by-step guide for configuring Resource Manager when OLTP and reports (or other
long-running, low-priority operations) are sharing a database. In this scenario, the reports can contend with OLTP for resources, degrading
OLTP performance. This document provides a script for configuring Resource Manager to protect OLTP performance from the negative
effects of long-running, resource-intensive workloads.

DETAILS
When a database is shared by both OLTP and reports, it is likely that these workloads will contend for resources. You should consider using
Resource Manager to guard against unacceptable performance impacts to your OLTP workload.
How do you know if you really need Resource Manager to manage your mixed workloads?
Most databases are configured to have ample resources for typical workload levels. In these cases, Resource Manager serves as a
safeguard for unexpected surges in workload. These surges can be caused by:
Bad SQL execution plans
Ad-hoc queries
Spikes in workload caused by special events such as end-of-quarter reporting
A database can benefit from Resource Manager when the CPU load is high. You can detect performance degradation due to high CPU loads
in several ways:
Monitoring CPU utilization from the O/S or Enterprise Manager.
Long log file syncs, even though I/O latencies are low.
Configuring Resource Manager
The following script can be used to configure and enable a Resource Plan that prioritizes OLTP over long-running operations, such as
reports.
Note that this is a simple, single-level plan that does not require you to map sessions to consumer groups. We recommend that you start
with a simple plan and add complexity only as necessary.
begin
dbms_resource_manager.create_pending_area;
dbms_resource_manager.create_plan(
plan => 'oltp_plan',
comment => 'Plan that prioritizes short-running operations');
-- Sessions start in this consumer group.
-- If a query, transaction, or PL/SQL procedure consumes more than a minute
-- of CPU, the session is switched to the batch consumer group for the
-- duration of that operation
dbms_resource_manager.create_plan_directive(
plan => 'oltp_plan',
group_or_subplan => 'other_groups',
comment => 'Sessions start in this consumer group',
mgmt_p1 => 70,
switch_time => 60,
switch_group => 'batch_group',
switch_for_call => TRUE);
dbms_resource_manager.create_plan_directive(
plan => 'oltp_plan',

9/8/2015 8:38 PM

Document 1358709.1

2 of 3

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-stat...

group_or_subplan => 'batch_group',


comment => 'Long-running operations run in this low-priority consumer group',
mgmt_p1 => 15);
dbms_resource_manager.create_plan_directive(
plan => 'oltp_plan',
group_or_subplan => 'ora$autotask_sub_plan',
comment => 'Automated maintenance tasks run here',
mgmt_p1 => 15);
dbms_resource_manager_privs.grant_switch_consumer_group(
grantee_name => 'public',
consumer_group => 'batch_group',
grant_option => true);
dbms_resource_manager.submit_pending_area;
end;
/

You can now enable the plan by setting the Oracle parameter "resource_manager_plan" to "oltp_plan". For example,
alter system set resource_manager_plan = 'oltp_plan' sid='*';

Maintenance Windows
By default, the "default_maintenance_plan" resource plan is enabled during the maintenance window. If you did not create a resource plan
for your database, the "default_maintenance_plan" provides effective management of automated maintenance tasks.
Once you create a resource plan for your database, Oracle recommends that
1. Your resource plan contains a directive for maintenance tasks. You should create the maintenance task directive for the
"ora$autotask_sub_plan" subplan in 11g and for the "ora$autotask" consumer group in 12c. Outside of the maintenance windows,
automated tasks do not run and this allocation will be reallocated to the other consumer groups.
2. You enable a single resource plan both during and outside the maintenance windows. Enable the resource plan using the
"resource_manager_plan" parameter. Then, disable the default_maintenance_plan from the maintenance windows, using the script
below. Your resource plan will then be used both during and outside the maintenance windows.

begin
dbms_scheduler.set_attribute_null(
name => 'SUNDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
dbms_scheduler.set_attribute_null(
name => 'MONDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
dbms_scheduler.set_attribute_null(
name => 'TUESDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
dbms_scheduler.set_attribute_null(
name => 'WEDNESDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
dbms_scheduler.set_attribute_null(
name => 'THURSDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
dbms_scheduler.set_attribute_null(
name => 'FRIDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
dbms_scheduler.set_attribute_null(
name => 'SATURDAY_WINDOW',
attribute => 'RESOURCE_PLAN');
end;
/

9/8/2015 8:38 PM

Document 1358709.1

3 of 3

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-stat...

Enabling Exadata I/O Resource Manager


If your database is deployed on Exadata, you can also enable Exadata I/O Resource Manager (IORM). In general, OLTP and I/O-intensive
workloads (like reports) can co-exist well on Exadata because the OLTP I/Os tend to use flash while the I/O-intensive workloads tend to use
disk. However, when OLTP workloads do need to access disk, the I/O-intensive workloads can result in long latencies for the OLTP I/Os.
To address or guard against this issue, you can use IORM. IORM uses the same resource plan used by the database. Therefore, the only
configuration step is to enable IORM.
For Exadata cells on versions 11.2.2.3 and above, use the following CellCLI commands:
alter iormplan active;
alter iormplan objective=auto;

For Exadata cells on versions 11.2.2.2 and below, use the following CellCLI command:
alter iormplan active;

Monitoring Resource Manager


Once you have enabled Resource Manager, we recommend that you monitor it as follows.
First, use the v$rsrc_plan query in MOS Document 1338988.1 to verify that "oltp_plan" is enabled.
Second, use the v$rsrcmgrmetric_history query (also in MOS Document 1338988.1) to monitor CPU usage and waits. The "avg_running"
column shows the average number of sessions per consumer group that are running on CPU. The "avg_waiting" column shows the average
number of sessions per consumer group that are waiting to run, but are being throttled by Resource Manager. For a more detailed
explanation and tips for tuning this resource plan, please refer to the MOS note.
Third, if you enabled IORM, use the script in MOS Document 1337265.1 to monitor the disk latencies, flash hit rates, and I/O rates by
consumer group. For a detailed explanation and tips for tuning IORM, please refer to the MOS note.

REFERENCES
NOTE:1339769.1
NOTE:1339803.1
NOTE:1337265.1
NOTE:1338988.1

Master Note for Oracle Database Resource Manager


Recommended Patches for CPU Resource Manager
Tool for Gathering I/O Resource Manager Metrics: metric_iorm.pl
Scripts and Tips for Monitoring CPU Resource Manager

Didn't find what you are looking for?

9/8/2015 8:38 PM

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