+ All Categories
Home > Documents > Managing Resources

Managing Resources

Date post: 13-Jan-2016
Category:
Upload: gur
View: 28 times
Download: 0 times
Share this document with a friend
Description:
Managing Resources. Objectives. After completing this lesson, you should be able to do the following: Set up Database Resource Manager Assign users to Resource Manager groups Create resource plans within groups. Overview. Manage mixed workload Control system performance. - PowerPoint PPT Presentation
37
15 Copyright © 2004, Oracle. All rights reserved. Managing Resources
Transcript
Page 1: Managing Resources

15Copyright © 2004, Oracle. All rights reserved.

Managing Resources

Page 2: Managing Resources

15-2 Copyright © 2004, Oracle. All rights reserved.

Objectives

After completing this lesson, you should be able to do the following:

• Set up Database Resource Manager

• Assign users to Resource Manager groups

• Create resource plans within groups

Page 3: Managing Resources

15-3 Copyright © 2004, Oracle. All rights reserved.

OLTP More resources

DSSuser

OLTPuser

Database resource manager

DSS Less resources Oracle

Database

Overview

• Manage mixed workload

• Control system performance

Page 4: Managing Resources

15-4 Copyright © 2004, Oracle. All rights reserved.

Resource plan directives

Database ResourceManager Concepts

User groups or sessions with similar resource needs

A blueprint for resource allocation among resource consumer groups (one active plan)

Specifies how a resource is divided among the resource consumer groups

Resource consumer

group

Resource plan

Page 5: Managing Resources

15-5 Copyright © 2004, Oracle. All rights reserved.

BUG MAINT Group

70% @ L1

MYDB PLAN

30% @ L1

Using Sub-Plans to Limit CPU Utilization

MAILDBPLAN

ONLINEGroup

BATCHGroup

DELIVERYGroup

MAILSORTGroup

OTHERGroups

BUGDB PLAN

100% @ L2 100% @ L2

100% @ L3

100% @ L1 20% @ L180% @ L1

Page 6: Managing Resources

15-7 Copyright © 2004, Oracle. All rights reserved.

BUG MAINT Group

70% @ L1

MYDB PLAN

Limiting CPU Utilization: Example

ONLINEGroup

BATCHGroup

20% @ L180% @ L1

BUGDB PLAN

100% @ L2

30% @ L1

100% @ L1

100% @ L2

MAILDBPLAN

DELIVERYGroup

MAILSORTGroup

OTHERGroups

100% @ L3

Page 7: Managing Resources

15-8 Copyright © 2004, Oracle. All rights reserved.

Resource Manager Configurations

• You can manage database and operating system resources, such as:– CPU usage– Number of active sessions– Degree of parallelism– Undo generation– Operation execution time– Idle time

• You can also specify criteria that, if met, causes the automatic switching of sessions to another consumer group.

Page 8: Managing Resources

15-10 Copyright © 2004, Oracle. All rights reserved.

Active Session Pool Mechanism

OLTP Users

Active_sess_pool_P1=5

DSS Users

Active_sess_pool=3

Sess6 Sess7

Sess8

p001 p002 p003

DSSActive

SessionQueue

Sess10

Sess9

Sess1 Sess2

Sess3

Sess5Sess4

Page 9: Managing Resources

15-11 Copyright © 2004, Oracle. All rights reserved.

Setting the Active Session Pool

Page 10: Managing Resources

15-12 Copyright © 2004, Oracle. All rights reserved.

Setting the Active Session Pool

Example:

• OLTP: Set no limit on concurrent active sessions

• BATCH: Set to limit concurrent active sessions to 5

• QUEUEING_P1, set to 600, aborts all operations that wait on the queue for more than ten minutes

GROUP

ONLINE

BATCH

ACTIVE SESSION POOL

No limits

ACTIVE_SESS_POOL_P1 = 5

QUEUEING_P1 = 600

Page 11: Managing Resources

15-13 Copyright © 2004, Oracle. All rights reserved.

Automatic Consumer Group Switching

ONLINE Group

BATCH Group

Sess3

Sess1 Sess2

Sess4 Sess5

SWITCH_GROUP=BATCH_GROUPSWITCH_TIME_IN_CALL=180SWITCH_ESTIMATE=TRUE

SWITCH_GROUP=ONLINE_GROUPSWITCH_TIME=43200

SWITCH_ESTIMATE=FALSE

Page 12: Managing Resources

15-15 Copyright © 2004, Oracle. All rights reserved.

Automatic Consumer Group Switching

ONLINE Group

Sess3

Sess1 Sess2

SELECT c.cust_last_name, line_item_id, product_idFROM customers c, orders o, order_itemsWHERE c.customer_id = ...;

SWITCH_GROUP='CANCEL_SQL'

SWITCH_TIME=300

SWITCH_ESTIMATE=TRUE

Page 13: Managing Resources

15-16 Copyright © 2004, Oracle. All rights reserved.

Configuring Consumer Group Switching

Page 14: Managing Resources

15-17 Copyright © 2004, Oracle. All rights reserved.

Adaptive Consumer Group Mapping

Page 15: Managing Resources

15-18 Copyright © 2004, Oracle. All rights reserved.

Creating a Mapping Using DBMS_RESOURCE_MANAGER

DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING (DBMS_RESOURCE_MANAGER.ORACLE_USER, 'PDML', 'DSS_GROUP');

DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING (DBMS_RESOURCE_MANAGER.ORACLE_USER, 'TP1', 'OLTP_GROUP');

DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING (DBMS_RESOURCE_MANAGER.CLIENT_OS_USER, 'BILL', 'MANAGER_GROUP');

Page 16: Managing Resources

15-19 Copyright © 2004, Oracle. All rights reserved.

DBMS_RESOURCE_MANAGER.SET_CONSUMER_GROUP_MAPPING_PRI(EXPLICIT => 1, -- highest SERVICE_MODULE => 2, SERVICE_MODULE_ACTIONS => 3, MODULE_NAME_ACTION => 4, MODULE_NAME => 5, SERVICE_NAME => 6, ORACLE_USER => 9, CLIENT_PROGRAM => 8, CLIENT_OS_USER => 7, CLIENT_MACHINE => 10); -- lowest

Assigning Priorities Using DBMS_RESOURCE_MANAGER

Page 17: Managing Resources

15-20 Copyright © 2004, Oracle. All rights reserved.

The Initial Plan: SYSTEM_PLAN

Resource ConsumerGroup

Allocation Methods

CPU_P1 CPU_P2 CPU_P3

SYS_GROUP 100% 0% 0%

OTHER_GROUPS 0% 100% 0%

LOW_GROUP 0% 0% 100%

Page 18: Managing Resources

15-21 Copyright © 2004, Oracle. All rights reserved.

Creating a New Resource Plan

There are three ways to create a new resource plan:

• Use Enterprise Manager

• Use the CREATE_SIMPLE_PLAN procedure of DBMS_RESOURCE_MANAGER

• Use the procedures in the DBMS_RESOURCE_MANAGER package to create a complex plan.

Page 19: Managing Resources

15-23 Copyright © 2004, Oracle. All rights reserved.

Oracle Enterprise Manager:Resource Manager

Page 20: Managing Resources

15-24 Copyright © 2004, Oracle. All rights reserved.

Creating a Simple Plan

BEGIN DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN( SIMPLE_PLAN => 'simple_plan1', CONSUMER_GROUP1 => 'mygroup1', GROUP1_CPU => 80, CONSUMER_GROUP2 => 'mygroup2', GROUP2_CPU => 20);END;

Page 21: Managing Resources

15-25 Copyright © 2004, Oracle. All rights reserved.

Creating a Complex Plan

Page 22: Managing Resources

15-26 Copyright © 2004, Oracle. All rights reserved.

Resource Allocation Methods for Resource Plans

Parameter Possible Values

CPU_MTH EMPHASIS

RATIO

PARALLEL_DEGREE_LIMIT_MTH PARALLEL_DEGREE_LIMIT_ABSOLUTE

ACTIVE_SESS_POOL_MTH ACTIVE_SESS_POOL_ABSOLUTE

QUEUING_MTH FIFO_TIMEOUT

Page 23: Managing Resources

15-28 Copyright © 2004, Oracle. All rights reserved.

Comparison of EMPHASIS and RATIO

EMPHASIS RATIO

The value specifies the maximum percentage of CPU resources a consumer group can use.

The value specifies a number that indicates the ratio of CPU resources to be allocated to the consumer group.

You can allocate resources for up to 8 different levels.

You can only specify values for one level.

The sum of percentages at any given level must be less than or equal to 100.

You must use integer values, but there is no limit on the sum of values.

Default value is NULL. Default value is NULL.

Page 24: Managing Resources

15-30 Copyright © 2004, Oracle. All rights reserved.

Creating Resource Consumer Groups

Page 25: Managing Resources

15-32 Copyright © 2004, Oracle. All rights reserved.

Assigning Users to Consumer Groups

Page 26: Managing Resources

15-33 Copyright © 2004, Oracle. All rights reserved.

Resource Allocation Methods for Consumer Groups

Parameter Possible Values

CPU_MTH ROUND_ROBIN

RUN_TO_COMPLETION

Page 27: Managing Resources

15-34 Copyright © 2004, Oracle. All rights reserved.

Administering the Resource Manager

• Grant privileges to administer the Resource Manager to users

• Activate a plan for the database instance

• Switch the current group for users or sessions with the package DBMS_RESOURCE_MANAGER or DBMS_SESSION

• Monitoring Resource Manager objects:– Consumer groups– Resource plans– Resource plan directives– Resource consumer group mappings

Page 28: Managing Resources

15-35 Copyright © 2004, Oracle. All rights reserved.

Assigning Resource Manager Privileges

Page 29: Managing Resources

15-36 Copyright © 2004, Oracle. All rights reserved.

Setting the Resource Plan for an Instance

Page 30: Managing Resources

15-38 Copyright © 2004, Oracle. All rights reserved.

DECLARE

old_grp VARCHAR2(32);

BEGIN

DBMS_SESSION.SWITCH_CURRENT_CONSUMER_GROUP (

new_consumer_group => 'ONLINE_GROUP',

old_consumer_group => old_grp,

initial_group_on_error => FALSE );

END;

/

Changing a Consumer GroupWithin a Session

The user or the application can manually switch the current consumer group.

Page 31: Managing Resources

15-39 Copyright © 2004, Oracle. All rights reserved.

Changing Consumer Groups for Sessions

• Can be set by DBA for a session

• Can be set by DBA for all sessions for a user

EXEC DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_FOR_SESS ( -

session_id => 7, -

session_serial => 13, -

consumer_group => 'ONLINE_GROUP');

EXEC DBMS_RESOURCE_MANAGER.SWITCH_CONSUMER_GROUP_

FOR_USER ( -

user => 'SCOTT', -

consumer_group => 'BUG_MAINT_GROUP');

Page 32: Managing Resources

15-40 Copyright © 2004, Oracle. All rights reserved.

Database Resource Manager Information

View Name Information

DBA_RSRC_PLANS plans and status

DBA_RSRC_PLAN_DIRECTIVES plan directives

DBA_RSRC_CONSUMER_GROUPS consumer groups

DBA_RSRC_CONSUMER_GROUP_PRIVS users/roles

DBA_USERS columninitial_rsrc_ consumer_group

DBA_RSRC_MANAGER_SYSTEM_PRIVS users/roles

Page 33: Managing Resources

15-41 Copyright © 2004, Oracle. All rights reserved.

Resource Plan Directives

SQL> SELECT plan, group_or_subplan, cpu_p1, cpu_p2, 2 cpu_p3, parallel_degree_limit_p1, status 3 FROM DBA_RSRC_PLAN_DIRECTIVES;

Page 34: Managing Resources

15-43 Copyright © 2004, Oracle. All rights reserved.

Monitoring the Resource Manager

Page 35: Managing Resources

15-44 Copyright © 2004, Oracle. All rights reserved.

Monitoring the Resource Manager

• V$SESSION: Contains the resource_consumer_group column that shows the current group for a session

• V$RSRC_PLAN: A view that shows the active resource plan

• V$RSRC_CONSUMER_GROUP: A view that contains statistics for all active groups

Page 36: Managing Resources

15-46 Copyright © 2004, Oracle. All rights reserved.

Summary

In this lesson, you should have learned how to do the following:

• Set up Database Resource Manager

• Assign users to Resource Manager groups

• Create resource plans within groups

Page 37: Managing Resources

15-47 Copyright © 2004, Oracle. All rights reserved.

Practice 15 Overview: Using the Resource Manager

This practice covers the following topics:

• Creating resource consumer groups

• Specifying CPU resource allocation directives for consumer groups

• Associating users with a resource consumer group using Adaptive Consumer Group Mapping


Recommended