Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E25494-02 |
|
|
PDF · Mobi · ePub |
This section provides some examples of resource plans. The following examples are presented:
The following PL/SQL block creates a multilevel plan as illustrated in Figure 27-3. Default resource allocation method settings are used for all plans and resource consumer groups.
BEGIN DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_PLAN(PLAN => 'bugdb_plan', COMMENT => 'Resource plan/method for bug users sessions'); DBMS_RESOURCE_MANAGER.CREATE_PLAN(PLAN => 'maildb_plan', COMMENT => 'Resource plan/method for mail users sessions'); DBMS_RESOURCE_MANAGER.CREATE_PLAN(PLAN => 'mydb_plan', COMMENT => 'Resource plan/method for bug and mail users sessions'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'Online_group', COMMENT => 'Resource consumer group/method for online bug users sessions'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'Batch_group', COMMENT => 'Resource consumer group/method for batch job bug users sessions'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'Bug_Maint_group', COMMENT => 'Resource consumer group/method for users sessions for bug db maint'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'Users_group', COMMENT => 'Resource consumer group/method for mail users sessions'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'Postman_group', COMMENT => 'Resource consumer group/method for mail postman'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'Mail_Maint_group', COMMENT => 'Resource consumer group/method for users sessions for mail db maint'); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'bugdb_plan', GROUP_OR_SUBPLAN => 'Online_group', COMMENT => 'online bug users sessions at level 1', MGMT_P1 => 80, MGMT_P2=> 0); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'bugdb_plan', GROUP_OR_SUBPLAN => 'Batch_group', COMMENT => 'batch bug users sessions at level 1', MGMT_P1 => 20, MGMT_P2 => 0, PARALLEL_DEGREE_LIMIT_P1 => 8); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'bugdb_plan', GROUP_OR_SUBPLAN => 'Bug_Maint_group', COMMENT => 'bug maintenance users sessions at level 2', MGMT_P1 => 0, MGMT_P2 => 100); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'bugdb_plan', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'all other users sessions at level 3', MGMT_P1 => 0, MGMT_P2 => 0, MGMT_P3 => 100); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'maildb_plan', GROUP_OR_SUBPLAN => 'Postman_group', COMMENT => 'mail postman at level 1', MGMT_P1 => 40, MGMT_P2 => 0); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'maildb_plan', GROUP_OR_SUBPLAN => 'Users_group', COMMENT => 'mail users sessions at level 2', MGMT_P1 => 0, MGMT_P2 => 80); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'maildb_plan', GROUP_OR_SUBPLAN => 'Mail_Maint_group', COMMENT => 'mail maintenance users sessions at level 2', MGMT_P1 => 0, MGMT_P2 => 20); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'maildb_plan', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'all other users sessions at level 3', MGMT_P1 => 0, MGMT_P2 => 0, MGMT_P3 => 100); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'mydb_plan', GROUP_OR_SUBPLAN => 'maildb_plan', COMMENT=> 'all mail users sessions at level 1', MGMT_P1 => 30); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'mydb_plan', GROUP_OR_SUBPLAN => 'bugdb_plan', COMMENT => 'all bug users sessions at level 1', MGMT_P1 => 70); DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
The preceding call to VALIDATE_PENDING_AREA
is optional because the validation is implicitly performed in SUBMIT_PENDING_AREA
.
In this plan schema, CPU resources are allocated as follows:
Under mydb_plan
, 30% of CPU is allocated to the maildb_plan
subplan, and 70% is allocated to the bugdb_plan
subplan. Both subplans are at level 1. Because mydb_plan
itself has no levels below level 1, any resource allocations that are unused by either subplan at level 1 can be used by its sibling subplan. Thus, if maildb_plan
uses only 20% of CPU, then 80% of CPU is available to bugdb_plan
.
maildb_plan
and bugdb_plan
define allocations at levels 1, 2, and 3. The levels in these subplans are independent of levels in their parent plan, mydb_plan
. That is, all plans and subplans in a plan schema have their own level 1, level 2, level 3, and so on.
Of the 30% of CPU allocated to maildb_plan
, 40% of that amount (effectively 12% of total CPU) is allocated to Postman_group
at level 1. Because Postman_group
has no siblings at level 1, there is an implied 60% remaining at level 1. This 60% is then shared by Users_group
and Mail_Maint_group
at level 2, at 80% and 20%, respectively. In addition to this 60%, Users_group
and Mail_Maint_group
can also use any of the 40% not used by Postman_group
at level 1.
CPU resources not used by either Users_group
or Mail_Maint_group
at level 2 are allocated to OTHER_GROUPS
, because in multilevel plans, unused resources are reallocated to consumer groups or subplans at the next lower level, not to siblings at the same level. Thus, if Users_group
uses only 70% instead of 80%, the remaining 10% cannot be used by Mail_Maint_group
. That 10% is available only to OTHER_GROUPS
at level 3.
The 70% of CPU allocated to the bugdb_plan
subplan is allocated to its consumer groups in a similar fashion. If either Online_group
or Batch_group
does not use its full allocation, the remainder may be used by Bug_Maint_group
. If Bug_Maint_group
does not use all of that allocation, the remainder goes to OTHER_GROUPS
.
You can use the MAX_UTILIZATION_LIMIT
directive attribute to limit the CPU utilization for applications. One of the most common scenarios in which this attribute can be used is for database consolidation.
During database consolidation, you may need to be able to do the following:
Manage the performance impact that one application can have on another.
One method of managing this performance impact is to create a consumer group for each application and allocate resources to each consumer group.
Limit the utilization of each application.
Typically, in addition to allocating a specific percentage of the CPU resources to each consumer group, you may need to limit the maximum CPU utilization for each group. This limit prevents a consumer group from using all of the CPU resources when all the other consumer groups are idle.
In some cases, you may want all application users to experience consistent performance regardless of the workload from other applications. This can be achieved by specifying a maximum utilization limit for each consumer group in a resource plan.
The following examples demonstrate how to use the MAX_UTILIZATION_LIMIT
resource plan directive attribute to:
Restrict total database CPU utilization
Quarantine runaway queries
Limit CPU usage for applications
Limit CPU utilization during maintenance windows
Example 1 - Restricting Overall Database CPU Utilization
In this example, regardless of database load, system workload from Oracle Database never exceeds 90% of CPU, leaving 10% of CPU for other applications sharing the server.
BEGIN DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_PLAN( PLAN => 'MAXCAP_PLAN', COMMENT => 'Limit overall database CPU'); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'MAXCAP_PLAN', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'This group is mandatory', MAX_UTILIZATION_LIMIT => 90); DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
Because there is no plan directive other than the one for OTHER_GROUPS
, all sessions are mapped to OTHER_GROUPS
.
Example 2 - Quarantining Runaway Queries
In this example, runaway queries are switched to a consumer group with a maximum utilization limit of 20%, limiting the amount of resources that they can consume until you can intervene. A runaway query is characterized here as one that takes more than 10 minutes of CPU time. Assume that session mapping rules start all sessions in START_GROUP
.
BEGIN DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'START_GROUP', COMMENT => 'Sessions start here'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'QUARANTINE_GROUP', COMMENT => 'Sessions switched here to quarantine them'); DBMS_RESOURCE_MANAGER.CREATE_PLAN( PLAN => 'Quarantine_plan', COMMENT => 'Quarantine runaway queries'); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'Quarantine_plan', GROUP_OR_SUBPLAN => 'START_GROUP', COMMENT => 'Max CPU 10 minutes before switch', MGMT_P1 => 75, switch_group => 'QUARANTINE_GROUP', switch_time => 600); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'Quarantine_plan', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'Mandatory', MGMT_P1 => 25); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE( PLAN => 'Quarantine_plan', GROUP_OR_SUBPLAN => 'QUARANTINE_GROUP', COMMENT => 'Limited CPU', MGMT_P2 => 100, MAX_UTILIZATION_LIMIT => 20); DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
Caution:
Although you could set the maximum utilization limit to zero forQUARANTINE_GROUP
, thus completely quarantining runaway queries, it is recommended that you avoid doing this. If the runaway query is holding any resources—PGA memory, locks, and so on—required by any other session, then a zero allocation setting could lead to a deadlock.Example 3 - LImiting CPU for Applications
In this example, assume that mapping rules map application sessions into one of four application groups. Each application group is allocated a maximum utilization limit of 30%. This limits CPU utilization of any one application to 30%. The sum of the MAX_UTILIZATION_LIMIT
values exceeds 100%, which is permissible and acceptable in a situation where all applications are not active simultaneously.
BEGIN DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP1_GROUP', COMMENT => 'Apps group 1'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP2_GROUP', COMMENT => 'Apps group 2'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP3_GROUP', COMMENT => 'Apps group 3'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP4_GROUP', COMMENT => 'Apps group 4'); DBMS_RESOURCE_MANAGER.CREATE_PLAN( PLAN => 'apps_plan', COMMENT => 'Application consolidation'); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'apps_plan', GROUP_OR_SUBPLAN => 'APP1_GROUP', COMMENT => 'Apps group 1', MAX_UTILIZATION_LIMIT => 30); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'apps_plan', GROUP_OR_SUBPLAN => 'APP2_GROUP', COMMENT => 'Apps group 2', MAX_UTILIZATION_LIMIT => 30); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'apps_plan', GROUP_OR_SUBPLAN => 'APP3_GROUP', COMMENT => 'Apps group 3', MAX_UTILIZATION_LIMIT => 30); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'apps_plan', GROUP_OR_SUBPLAN => 'APP4_GROUP', COMMENT => 'Apps group 4', MAX_UTILIZATION_LIMIT => 30); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'apps_plan', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'Mandatory', MAX_UTILIZATION_LIMIT => 20); DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
If all four application groups can fully use the CPU allocated to them (30% in this case), then the minimum CPU that is allocated to each application group is computed as a ratio of the application group's limit to the total of the limits of all application groups. In this example, all four application groups are allocated a maximum utilization limit of 30%. Therefore, when all four groups fully use their limits, the CPU allocation to each group is 30/(30+30+30+30) = 25%.
Example 4 - Specifying a Maximum Utilization Limit for Consumer Groups and Subplans
The following example describes how the maximum utilization limit is computed for scenarios, such as the one in Figure 27-4, where you set MAX_UTILIZATION_LIMIT
for a subplan and for consumer groups within the subplan. For simplicity, the requirement to include the OTHER_GROUPS
consumer group is ignored, and resource plan directives are not shown, even though they are part of the plan.
Figure 27-4 Resource Plan with Maximum Utilization for Subplan and Consumer Groups
The following PL/SQL block creates the plan described in Figure 27-4.
BEGIN DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP1_GROUP', COMMENT => 'Group for application #1'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP2_OLTP_GROUP', COMMENT => 'Group for OLTP activity in application #2'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP2_ADHOC_GROUP', COMMENT => 'Group for ad-hoc queries in application #2'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP ( CONSUMER_GROUP => 'APP2_REPORT_GROUP', COMMENT => 'Group for reports in application #2'); DBMS_RESOURCE_MANAGER.CREATE_PLAN( PLAN => 'APPS_PLAN', COMMENT => 'Plan for managing 3 applications'); DBMS_RESOURCE_MANAGER.CREATE_PLAN( PLAN => 'APP2_SUBPLAN', COMMENT => 'Subplan for managing application #2', SUB_PLAN => TRUE); DBMS_RESOURCE_MANAGER.CREATE_PLAN( PLAN => 'APP2_REPORTS_SUBPLAN', COMMENT => 'Subplan for managing reports in application #2', SUB_PLAN => TRUE); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APPS_PLAN', GROUP_OR_SUBPLAN => 'APP1_GROUP', COMMENT => 'Limit CPU for application #1 to 40%', MAX_UTILIZATION_LIMIT => 40); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APPS_PLAN', GROUP_OR_SUBPLAN => 'APP2_SUBPLAN', COMMENT => 'Limit CPU for application #2 to 40%', MAX_UTILIZATION_LIMIT => 40); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APP2_SUBPLAN', GROUP_OR_SUBPLAN => 'APP2_OLTP_GROUP', COMMENT => 'Limit CPU for OLTP to 90% of application #2', MAX_UTILIZATION_LIMIT => 90); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APP2_SUBPLAN', GROUP_OR_SUBPLAN => 'APP2_REPORTS_SUBPLAN', COMMENT => 'Subplan for ad-hoc and normal reports for application #2'); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APP2_REPORTS_SUBPLAN', GROUP_OR_SUBPLAN => 'APP2_ADHOC_GROUP', COMMENT => 'Limit CPU for ad-hoc queries to 50% of application #2 reports', MAX_UTILIZATION_LIMIT => 50); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APP2_REPORTS_SUBPLAN', GROUP_OR_SUBPLAN => 'APP2_REPORT_GROUP', COMMENT => 'Limit CPU for reports to 50% of application #2 reports', MAX_UTILIZATION_LIMIT => 50); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE ( PLAN => 'APPS_PLAN', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'No directives for default users'); DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
In this example, the maximum CPU utilization for the consumer group APP1_GROUP
and subplan APP2_SUBPLAN
is set to 40%. The limit for the consumer groups APP2_ADHOC_GROUP
and APP2_REPORT_GROUP
is set to 50%.
Because there is no limit specified for the subplan APP2_REPORTS_SUBPLAN
, it inherits the limit of its parent subplan APP2_SUBPLAN
, which is 40%. The absolute limit for the consumer group APP2_REPORT_GROUP
is computed as 50% of its parent subplan, which is 50% of 40%, or 20%.
Similarly, because the consumer group APP2_ADHOC_GROUP
is contained in the subplan APP2_REPORTS_SUBPLAN
, its limit is computed as a percentage of its parent subplan. The maximum utilization limit for the consumer group APP2_ADHOC_GROUP
is 50% of 40%, or 20%.
The maximum CPU utilization for the consumer group APP2_OLTP_GROUP
is set to 90%. The parent subplan of APP2_OLTP_GROUP
, APP2_SUBPLAN
, has a limit of 40%. Therefore, the absolute limit for the group APP2_OLTP_GROUP
is 90% of 40%, or 36%.
The example presented here could represent a plan for a database supporting a packaged ERP (Enterprise Resource Planning) or CRM (Customer Relationship Management) application. The work in such an environment can be highly varied. There may be a mix of short transactions and quick queries, in combination with longer running batch jobs that include large parallel queries. The goal is to give good response time to OLTP (Online Transaction Processing), while allowing batch jobs to run in parallel.
The plan is summarized in the following table.
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% | -- | -- | -- |
By assigning only 80% of the CPU to oltp
at level 1, batch
is guaranteed to get at least 20%, plus any of oltp
's unused CPU resources. OTHER_GROUPS
, however, is not guaranteed any CPU resources. It gets CPU resources only if batch
cannot consume all of its allocation. A similar-looking plan would give oltp
80% and batch
20%, both at level 1, and OTHER_GROUPS
100% at level 2. With this plan, oltp
's unused CPU allocation would be given to OTHER_GROUPS
, not batch
.
The following statements create the preceding plan, which is named erp_plan
:
BEGIN DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_PLAN(PLAN => 'erp_plan', COMMENT => 'Resource plan/method for ERP Database'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'oltp', COMMENT => 'Resource consumer group/method for OLTP jobs'); DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(CONSUMER_GROUP => 'batch', COMMENT => 'Resource consumer group/method for BATCH jobs'); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'erp_plan', GROUP_OR_SUBPLAN => 'oltp', COMMENT => 'OLTP sessions', MGMT_P1 => 80, SWITCH_GROUP => 'batch', SWITCH_TIME => 3, UNDO_POOL => 200); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'erp_plan', GROUP_OR_SUBPLAN => 'batch', COMMENT => 'BATCH sessions', MGMT_P2 => 100, ACTIVE_SESS_POOL_P1 => 5, QUEUEING_P1 => 600, MAX_EST_EXEC_TIME => 3600); DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(PLAN => 'erp_plan', GROUP_OR_SUBPLAN => 'OTHER_GROUPS', COMMENT => 'mandatory', MGMT_P3 => 100); DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
A typical data warehousing environment consists of different types of users with varying resource requirements. Users with common processing needs are grouped into a consumer group. The consumer group URGENT_GROUP
consists of users who run reports that provide important information to top management. This group generates a large number of parallel queries. Users from the consumer group ETL_GROUP
import data from source systems and perform extract, transform, and load (ETL) operations. The group OTHER_GROUPS
contains users who execute ad-hoc queries. You must manage the requirements of these diverse groups of users while optimizing performance.
You can use the following directive attributes to manage and optimize the execution of parallel statements:
MGMT_P
n
PARALLEL_TARGET_PERCENTAGE
PARALLEL_QUEUE_TIMEOUT
PARALLEL_DEGREE_LIMIT_P1
Table 27-3 describes the resource allocations of the plan DW_PLAN
, which can be used to manage the needs of the data warehouse users. This plan contains the consumer groups URGENT_GROUP
, ETL_GROUP
, and OTHER_GROUPS
. This example demonstrates the use of directive attributes in ensuring that one application or consumer group does not use all the available parallel servers.
Table 27-3 Resource Plan with Parallel Statement Directives
Consumer Group | Level 1 CPU Allocation | Level 2 CPU Allocation | Level 3 CPU Allocation | PARALLEL_DEGREE_LIMIT_P1 | PARALLEL_TARGET_PERCENTAGE | PARALLEL_QUEUE_TIMEOUT |
---|---|---|---|---|---|---|
|
100% |
12 |
||||
|
100% |
8 |
50% |
|||
|
100% |
2 |
50% |
360 |
In this example, the parameter PARALLEL_SERVERS_TARGET
is set to 64, which means that the number of parallel servers available is 64. The total number of parallel servers that can be used for parallel statement execution before URGENT_GROUP
sessions with PARALLEL_DEGREE_POLICY
set to AUTO
are added to the parallel statement queue is equal to 64. Because the PARALLEL_TARGET_PERCENTAGE
attribute of ETL_GROUP
and OTHER_GROUPS
is 50%, the maximum number of parallel servers that can be used by these groups is 50% of 64, or 32 parallel servers each.
Note that parallel statements from a consumer group will only be queued if the PARALLEL_DEGREE_POLICY
parameter is set to AUTO
and the total number of active servers for the consumer group is higher than PARALLEL_SERVERS_TARGET
. If PARALLEL_DEGREE_POLICY
is set to MANUAL
or LIMITED
, then the statements are run provided there are enough parallel servers available. The parallel servers used by such a statement will count toward the total number of parallel servers used by the consumer group. However, the parallel statement will not be added to the parallel statement queue.
Tip:
For low-priority applications, it is a common practice to set low values forPARALLEL_DEGREE_LIMIT_P1
and PARALLEL_TARGET_PERCENTAGE
.Because URGENT_GROUPS
has 100% of the allocation at level 1, its parallel statements will always be dequeued ahead of the other consumer groups from the parallel statement queue. Although URGENT_GROUPS
has no PARALLEL_TARGET_PERCENTAGE
directive attribute, a statement issued by a session in this group might still be queued if there are not enough available parallel servers to run it.
The degree of parallelism, represented by PARALLEL_DEGREE_LIMIT_P1
, is set to 12 for URGENT_GROUP
. Therefore, each parallel statement from URGENT_GROUP
can use a maximum of 12 parallel servers. Similarly, each parallel statement from the ETL_GROUP
can use a maximum of 8 parallel servers and each parallel statement from the OTHER_GROUPS
can use 2 parallel servers.
Suppose, at a given time, the only parallel statements are from the ETL_GROUP
, and they are using 26 out of the 32 parallel servers available to this group. Sessions from this consumer group have PARALLEL_DEGREE_POLICY
set to AUTO
. If another parallel statement with the PARALLEL_DEGREE_LIMIT_P1
attribute set to 8 is launched from ETL_GROUP
, then this query cannot be run immediately because the available parallel servers in the ETL_GROUP
is 32-26=6 parallel servers. The new parallel statement is queued until the number of parallel servers it requires is available in ETL_GROUP
.
While the parallel statements in ETL_GROUP
are being executed, suppose a parallel statement is launched from OTHER_GROUPS
. This group still has 32 parallel servers available and so the parallel statement is executed.
The PARALLEL_QUEUE_TIMEOUT
attribute for OTHER_GROUPS
is set to 360. Therefore, any parallel statement from this group can remain in the parallel server queue for 360 seconds only. After this time, the parallel statement is removed from the queue and the error ORA-07454
is returned.
Oracle Database includes a predefined resource plan, MIXED_WORKLOAD_PLAN
, that prioritizes interactive operations over batch operations, and includes the required subplans and consumer groups recommended by Oracle. MIXED_WORKLOAD_PLAN
is defined as follows:
In this plan, because INTERACTIVE_GROUP
is intended for short transactions, any call that consumes more than 60 seconds of CPU time is automatically switched to BATCH_GROUP
, which is intended for longer batch operations.
You can use this predefined plan if it is appropriate for your environment. (You can modify the plan, or delete it if you do not intend to use it.) Note that there is nothing special about the names BATCH_GROUP
and INTERACTIVE_GROUP
. The names reflect only the intended purposes of the groups, and it is up to you to map application sessions to these groups and adjust CPU resource allocation percentages accordingly so that you achieve proper resource management for your interactive and batch applications. For example, to ensure that your interactive applications run under the INTERACTIVE_GROUP
consumer group, you must map your interactive applications' user sessions to this consumer group based on user name, service name, program name, module name, or action, as described in "Specifying Session-to–Consumer Group Mapping Rules". You must map your batch applications to the BATCH_GROUP
in the same way. Finally, you must enable this plan as described in "Enabling Oracle Database Resource Manager and Switching Plans".
See Table 27-4 and Table 27-5 for explanations of the other resource consumer groups and subplans in this plan.