Anda di halaman 1dari 4

Resource Manager Enhancements in

Oracle Database 12c Release 1 (12.1)


2015-03-28 18:26:52 ORACLE-BASE
http://oracle-base.com/articles/12c/resource-manager-enhancements-12cr1.php
Oracle

This article describes the enhancements to automatic consumer group switching in Oracle 12c
Release 1 (12.1).

Runaway Query Management - Automatic Consumer Group Switching

Resource Manager with Container Databases (CDB) and Pluggable Databases (PDB)

Related articles.

Resource Manager in Oracle 8i

Resource Manager Enhancements In Oracle 9i

Resource Manager Enhancements in Oracle Database 10g

Resource Manager Enhancements in Oracle 11g

Instance Caging to Manage CPU Usage in Oracle Database 11g Release 2

Multitenant : Resource Manager with Container Databases (CDB) and Pluggable Databases
(PDB) in Oracle Database 12c Release 1 (12.1)

Runaway Query Management - Automatic

Consumer Group Switching

Managing runaway queries using automatic consumer group switching in resource manager has a
long history.

Oracle 8i allowed manual consumer group switching of a session using the


DBMS_SESSION.SWITCH_CURRENT_CONSUMER_GROUP procedure.
Oracle 9i introduced automatic consumer group switching using the SWITCH_TIME and
SWITCH_GROUP parameters of the CREATE_PLAN_DIRECTIVE procedure. The switch was based on
elapsed time of the session. Once switched, the consumer group was fixed for the lifetime of
the session. If the SWITCH_ESTIMATE parameter was set to TRUE, Oracle would estimate the
elapsed time and preemptively switch the consumer group if necessary before the execution
started.
Oracle 10g introduced the SWITCH_TIME_IN_CALL parameter, which could be used in place of
SWITCH_TIME to allow consumer group switching to work properly in connection pools where
sessions are shared, such that one session will service multiple independent calls.

Oracle 11g included a number of changes to this functionality. The SWITCH_TIME_IN_CALL


parameter was deprecated in favor of the combination of SWITCH_TIME and SWITCH_FOR_CALL . It
also allowed consumer group switching based on physical I/O size or I/O requests using the
SWITCH_IO_MEGABYTES and SWITCH_IO_REQS parameters respectively. In addition to allowing a
consumer group switching, the SWITCH_GROUP parameter could be set to KILL_SESSION or
CANCEL_SQL to control runaway queries. Oracle 11gR2 altered the SWITCH_TIME parameter so it
was no longer an elapsed time, but a measure of CPU seconds used.

Oracle 12c introduces a number of changes related to consumer group switching. The
SWITCH_GROUP parameter can now also be set to LOG_ONLY , so the trigger for a potential switch is
logged, but no actual consumer group switch is performed. Plan directives can now include the
SWITCH_IO_LOGICAL and SWITCH_ELAPSED_TIME parameters to trigger a consumer group switch, so the
current list of parameters for the CREATE_PLAN_DIRECTIVE procedure is now as follows.

SWITCH_GROUP : NULL , consumer_group_name , CANCEL_SQL , KILL_SESSION , LOG_ONLY .

SWITCH_TIME : Time in CPU seconds that will trigger a switch.

SWITCH_ESTIMATE : When set to TRUE, Oracle estimates the elapsed time and if necessary
switches the consumer group before the execution begins.

SWITCH_IO_MEGABYTES : The total size of I/O requests that will trigger a switch.

SWITCH_IO_REQS : The number of physical I/O requests that will trigger a switch.

SWITCH_FOR_CALL : When set to TRUE, the switch is based on each top-level call. Once the call
is complete, the consumer groups are switched back to original settings. When set to FALSE
the switch is at session level and the new consumer group will remain until the session ends.

SWITCH_IO_LOGICAL : The number of logical I/O requests that will trigger a switch.

SWITCH_ELAPSED_TIME : The elapsed time that will trigger a switch.

The allowable values of the SWITCH_GROUP parameter are described below.

NULL : Automatic consumer group switching is not enabled for this plan directive.

consumer_group_name : The consumer group the session/call should be switched to if a


threshold is reached.

CANCEL_SQL : If a threshold is reached, the current call is cancelled, but the session is not
killed.

KILL_SESSION : If a threshold is reached, the current session is killed.

LOG_ONLY : If a threshold is reached, the event is logged in SQL Monitor, but nothing happens
to the call or session.

For all the switch-related parameters, there is an equivalent NEW_* parameter for altering the
values using the UPDATE_PLAN_DIRECTIVE procedure.
V$SQL_MONITOR

The V$SQL_MONITOR view includes four new resource manager columns.

RM_LAST_ACTION : CANCEL_SQL , KILL_SESSION , LOG_ONLY , SWITCH TO <CG NAME>

RM_LAST_ACTION_REASON : SWITCH_CPU_TIME , SWITCH_IO_REQS , SWITCH_IO_MBS ,


SWITCH_ELAPSED_TIME , SWITCH_IO_LOGICAL

RM_LAST_ACTION_TIME : The time of the last resource manager action.

RM_CONSUMER_GROUP : The current consumer group.

Resource Manager with Container

Databases (CDB) and Pluggable

Databases (PDB)

In a multitennent environment resource manager performs two separate tasks. At the CDB level it
controls the resources allocated to each PDB, allowing you to prioritise some PDBs over others. At
the PDB level it controls the resources allocated to each session connected to the PDB, allowing
you to prioritise some sessions over others, just as it does in pre-12c instances.

Multitenant : Resource Manager with Container Databases (CDB) and Pluggable Databases
(PDB) in Oracle Database 12c Release 1 (12.1)

For more information see:

CREATE_PLAN_DIRECTIVE

V$SQL_MONITOR

Resource Manager in Oracle 8i

Resource Manager Enhancements In Oracle 9i

Resource Manager Enhancements in Oracle Database 10g

Resource Manager Enhancements in Oracle 11g

Instance Caging to Manage CPU Usage in Oracle Database 11g Release 2

Multitenant : Resource Manager with Container Databases (CDB) and Pluggable Databases
(PDB) in Oracle Database 12c Release 1 (12.1)
Hope this helps. Regards Tim...