1. Trang chủ
  2. » Công Nghệ Thông Tin

OCA /OCP Oracle Database 11g A ll-in-One Exam Guide- P85 docx

10 97 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 330,66 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

These will assign a consumer group according to the user process being used perhaps so that a data mining tool could have low priority, or the operating system ID on the client 1 EXPLICI

Trang 1

Table 21-1 lists all the attributes, in their default order of priority: the first to match

is applied Thus, an explicit setting will always take precedence, but if that has not been done (either manually or automatically), then the Resource Manager will try them in order until it finds one that has been configured

To use either MODULE or ACTION as the mapping attribute, your programmers must embed calls in their code to the DBMS_APPLICATION_INFO package to name the modules and the actions within them; typically, a PL/SQL package would be assigned a module name, and the procedures and functions within it could be named

as actions Thus, a session can be given a certain priority when it runs certain blocks

of code

To use the SERVICE as the mapping attribute, you must ensure that some users connect through one database service, and some through another This will require setting up multiple service names in the SERVICE_NAMES instance parameter (or programmatically, by using the DBMS_SERVICE package to create and start the services) and configuring the client side of Oracle Net such that different users will request a different service Then users who connect through one service (such as DSS) could be assigned to a lower priority group than users connecting through another service (such as OLTP)

The three CLIENT_* attributes are visible as the columns PROGRAM, OSUSER, and MACHINE in the V$SESSION dynamic performance view These will assign a consumer group according to the user process being used (perhaps so that a data mining tool could have low priority), or the operating system ID on the client

1 EXPLICIT Switch to a group either by using the API or by

using automatic consumer group switching.

2 SERVICE_MODULE_ACTION Switch to a group according to the action name

being executed, the program module, and the service used to connect.

3 SERVICE_MODULE Switch to a group according to the service name

used to connect and the program module.

4 MODULE_NAME_ACTION Switch to a group according to the program module

and the action within it being executed.

5 MODULE_NAME Switch to a group according to the program module.

6 SERVICE_NAME Activate a group at login according to the service

name used to connect.

7 ORACLE_USER Activate a group at login according to Oracle user

ID used to connect.

8 CLIENT_PROGRAM Activate a group at login according to the user

process being used to connect.

9 CLIENT_OS_USER Activate a group at login according to the operating

system ID on the client machine.

10 CLIENT_MACHINE Activate a group at login according to the name of

the client machine.

Table 21-1 Session Attributes

Trang 2

machine, or the machine itself (perhaps so that sessions from different application

servers could be assigned to different groups)

The order of the attributes in the preceding table is critical, and it can be changed

Consider a user connected to Oracle from a PC in the management accountants’

office (with the machine name DSS_PC1) as Oracle user CLERK You can use the

Resource Manager API to map both the Oracle username and the machine name to

a consumer group:

SQL> exec

dbms_resource_manager.set_consumer_group_mapping(-dbms_resource_manager.oracle_user,'CLERK','OLTP');

SQL> exec

dbms_resource_manager.set_consumer_group_mapping(-dbms_resource_manager.client_machine,'DSS_PC1','DSS');

By default, according to the preceding table, the user will be assigned to the OLTP

group, because his Oracle username takes precedence over the location he has

connected from This could be changed by swapping the order around:

SQL> exec

dbms_resource_manager.set_consumer_group_mapping_pri(EXPLICIT => 1,

SERVICE_MODULE_ACTION => 2,

SERVICE_MODULE => 3,

MODULE_NAME_ACTION => 4,

MODULE_NAME => 5,

SERVICE_NAME => 6,

ORACLE_USER => 10,

CLIENT_PROGRAM => 8,

CLIENT_OS_USER => 9,

-CLIENT_MACHINE => 7,);

From now on, the machine that the user is working from will determine his active

Resource Manager group, no matter what Oracle username he logs in as The current

order of precedence is displayed in the view DBA_RSRC_MAPPING_PRIORITY The

session could then be switched dynamically after the session has been established

according to which block of code he happens to be running

To manage mapping through Database Control, take the Resource Consumer

Group Mappings link in the Resource Manager section under the Administration tab

TIP The Resource Manager is a very powerful facility, but it is a mission to

set up Make use of the graphical tools (because the APIs are not a lot of

fun) and always copy the output of Show SQL, so that you can recreate the

environment if necessary

Exercise 21-2: Configure and Test Automatic Consumer Group

Switching Set up a mechanism that will automatically downgrade all large jobs

to a low priority Do this with Database Control, but whenever possible click the SHOW

SQL button and study the API calls being generated

1 Connect to your database as user SYSTEM with Database Control

2 Choose the Server tab on the database home page, and then the Consumer

Groups link in the Resource Manager section

Trang 3

3 Click CREATE to reach the Create Resource Consumer Group window.

4 Enter HIGH as the name of the group, and click ADD to display a list of all users

5 Select the check boxes for the four users you created earlier: ACCT, BATCH, CLERK, and MGR Click SELECT

6 Click OK to create the group and return to the Consumer Groups window

7 Select the new group, and click CREATE LIKE to create another group Name it

MEDIUM, and allocate your four users as members of the group Create a third group called LOW, and again allocate your four users as members of this group.

8 From the database home page, choose the Server tab; then click the Users link

in the Security section

9 Select each of the four users ACCT, BATCH, CLERK, and MGR in turn, and click EDIT On the Consumer Group Privileges tab, set the Default Consumer Group for each user to HIGH

10 Navigate to the Resource Plans window, and click CREATE to reach the Create

Resource Plan window Enter AUTO_SWITCH as the name of the plan, select

the Activate This Plan check box, and click MODIFY to reach the Select Groups/ Subplans window

11 Select your HIGH, MEDIUM, and LOW groups and move them to the

Resource Allocations section Click OK to return to the Create Resource Plan window

12 Enter priorities for the consumer groups at level 1, as shown in the illustration.

Trang 4

13 Choose the Threshold tab, and configure switching as in the illustration This

will switch users from their initial group of HIGH down to MEDIUM if a job

takes more than five seconds, and then down to LOW priority if it takes more

than ten seconds at MEDIUM

14 Click OK to execute the configuration, and return to the Resource Plans window.

15 In a SQL*Plus session, connect as user CLERK.

16 In a second SQL*Plus session, connect as user SYSTEM and confirm that

CLERK’s active group is HIGH:

SQL> select resource_consumer_group from v$session where username='CLERK';

17 In the CLERK session, simulate launching a large job by running a query that

does a Cartesian join based on a view with many rows, for example:

SQL> select count(*) from all_objects,all_objects;

18 While the query is running, in your second session reissue the query in Step 16

a few times, and you will see the CLERK session being downgraded from HIGH

to MEDIUM after five seconds, and then to LOW after a further ten seconds

19 Tidy up by using Database Control to activate the Default Plan.

Two-Minute Drill

Understand the Database Resource Manager

• The Resource Manager enables you to prioritize sessions

• Users are assigned to consumer groups, and plans allocate resources to these

groups

Trang 5

• Resources can be controlled by emphasis (CPU usage) and absolute methods (such as parallelism or execution time)

• Sessions can be switched between groups manually, or automatically

according to execution time or various session attributes

Create and Use Database Resource Manager

Components

• A pending area must be created in memory before working with the Resource Manager

• Users must be granted membership of consumer groups

• A plan can be activated by setting the RESOURCE_MANAGER_PLAN parameter manually, or with the DBMS_RESOURCE_MANAGER.SWITCH_PLAN

procedure call, or automatically by the Scheduler

• All sessions must have an active consumer group, which defaults to DEFAULT_ CONSUMER_GROUP

• Every plan must have a directive for the consumer group OTHER_GROUPS

Self Test

1 There are several steps involved in setting up the Resource Manager:

a Assign users to consumer groups.

b Create consumer groups

c Create directives

d Create the pending area

e Create the plan

f Submit the pending area

g Validate the pending area What is the correct order for accomplishing these steps? (Choose the best

answer.)

A d-e-g-f-c-b-a

B d-b-a-e-c-g-f

C d-b-a-c-e-g-f

D d-b-a-v-e-f-g

E b-a-d-e-c-f-g

Trang 6

2 Which of the following statements, if any, are correct about users and

consumer groups? (Choose all correct answers.)

A One user can only be a member of one consumer group

B One user can be a member of many consumer groups

C The SYS_GROUP is reserved for the user SYS

D By default, the initial group for all users is DEFAULT_CONSUMER_GROUP

3 Some actions in the Resource Manager API are done with procedures in the

package DBMS_RESOURCE_MANAGER_PRIVS, and others with procedures

in the package DBMS_RESOURCE_MANAGER Mark the following actions

accordingly:

A Granting the privilege to administer the Resource Manager

B Placing users in groups

C Removing users from groups

D Switching a session’s effective group

E Creating consumer groups

F Configuring how to map sessions to groups

4 Resource Manager plans can use a number of methods to control resources

Which of the following are possible? (Choose three correct answers.)

A CPU usage

B Tablespace quota usage

C Number of active sessions

D Number of idle sessions

E Volume of redo data generated

F Volume of undo data generated

5 A CPU method plan allocates resources at two levels as follows:

1 Level 1: SYS_GROUP, 50% OLTP, 50%

2 Level 2: DSS,50% BATCH, 50%

If the only users logged on are from the BATCH group, what percentage of

CPU can they use? (Choose the best answer.)

A 12.5%

B 25%

C 50%

D 100%

E The plan will not validate because it attempts to allocate 200% of CPU

resources

Trang 7

6 You create a Resource Manager plan limiting the active session pool for the group DSS to 3 What will happen if three members of the group are logged

on, and a fourth member attempts to connect? (Choose the best answer.)

A The new session will not be able to connect until an existing session disconnects

B The new session will be able to connect but will hang immediately

C The new session will be able to connect but will only be able to run queries, not DML statements

D Any statements the new session issues may hang, depending on other activity

7 If the active Resource Manager plan specifies that sessions belonging to a particular group may only have four parallel execution servers, what will happen if a session in that group issues a statement that requests six parallel execution servers? (Choose the best answer.)

A The statement will not run

B The statement will run with four parallel servers

C It will depend on the setting of the PARALLEL_MIN_PERCENT instance parameter

D It will depend on the setting of the PARALLEL_AUTOMATIC_TUNING instance parameter

8 When you use the Resource Manager to define an undo pool, what happens? (Choose the best answer.)

A If a user exceeds their quota on the undo tablespace, their session will hang

B If a user exceeds their quota on the undo tablespace, the statement running will be rolled back but the rest of the statement will remain intact

C If a group fills its undo pool, all the group’s transactions will hang until one session commits, rolls back, or is terminated

D The effect depends on whether RETENTION GUARANTEE is enabled for the undo tablespace

9 Which of the following statements are correct regarding adaptive consumer group switching? (Choose two answers.)

A If a group exceeds its permitted CPU usage, one or more of its sessions will

be downgraded

B Switching can be triggered by transient session attributes

C Switching can be triggered by SQL statement execution time or volume of I/O

D You can configure whether the switch is permanent, or for one statement

10 The pending area is an area of memory used to configure the Resource

Manager before saving the configuration to the data dictionary For which

Trang 8

of these operations must you create, validate, and submit a pending area?

(Choose the best answer.)

A Adding users to consumer groups

B Creating consumer groups

C Using the CREATE_SIMPLE_PLAN procedure

D None of the above

11 There are a number of session attributes that can be used to map a session

to a particular consumer group, other than the Oracle username Which

of the following is not a valid attribute for this purpose? (Choose the

best answer.)

A The operating system ID on the client machine

B The name of the program module being executed

C The time of the session logon

D The user process

Self Test Answers

1 þ C This is the correct sequence, though d-b-e-c-g-f-a will also work.

ý A, B, D, and E None of these sequences will work, because the pending

area must be active when working with groups and plans, and cannot be

validated after it has been submitted

2 þ B One user can be a member of many groups, though only one

membership is active at any time

ý A, C, and D A is wrong because there can be a many-to-many relationship

between users and groups C is wrong because it is possible to put other users

in the SYS group D is wrong because SYS and SYSTEM are, by default, in the

SYS_GROUP group

3 þ DBMS_RESOURCE_MANAGER_PRIVS: A, B, C

DBMS_RESOURCE_MANAGER: D, E, F

The DBMS_RESOURCE_MANAGER_PRIVS package handles security, while

the DBMS_RESOURCE_MANAGER package manages everything else

ý All other possibilities

4 þ A, C, and F The emphasis method controls CPU usage Active sessions

and volume of undo data are two of the absolute methods

ý B, D, and E Tablespace usage can be limited by quotas, not by the Resource

Manager Idle sessions can be timed out, but not limited in number Redo

volume is not a possible limit

Trang 9

5 þ D If no other sessions are connected, then all CPU resources will be

available to the connected sessions

ý A, B, C, and E A, B, and C misinterpret the “trickle down” nature of resource allocation E fails to appreciate that CPU is allocated at each priority

level, not across priority levels

6 þ D The session pool does not limit the number of sessions, only the

number of active sessions

ý A, B, and C A is wrong because it describes the effect of session limits in profiles, not the Resource Manager B is wrong because this result would only occur if the active session pool were full C is wrong because the Resource

Manager makes no distinction between the types of SQL statements

7 þ B The limit will override the request.

ý A, C, and D A is wrong because the intent of the Resource Manager is not to block statements, but to control them C and D refer to the instance

parameters that drive the optimizer, not the Resource Manager

8 þ C Undo pools refer to whole groups, not to individual users or sessions

If a group fills its pool, all sessions that are part of the group will hang until one issues a COMMIT or a ROLLBACK

ý A, B, and D Tablespace quotas are relevant to neither undo in general,

nor the Resource Manager Retention Guarantee does not apply either

9 þ B and C A session’s group membership is reevaluated whenever certain

attributes change, and can be triggered by execution time or I/O

ý A and D A is wrong because CPU usage is used for the emphasis method, not for the absolute methods that can trigger a group change D is wrong

because the whole point of adaptive switching is that it should be temporary

10 þ B Any creation or modification of Resource Manager objects requires a

pending area

ý A, C, and D A is wrong because placing users in groups is a modification

to the user, not the Resource Manager C is wrong because the CREATE_

SIMPLE_PLAN procedure automates the whole process, and so it does not

require explicitly creating a pending area D is wrong because group creation

is impossible without a pending area

11 þ C The time can control the plan, not users’ effective groups.

ý A, B, and D All of these are valid attributes for initial consumer group

mapping

Trang 10

CHAPTER 22

The Scheduler

Exam Objectives

In this chapter you will learn to

• 053.18.1 Create a Job, Program, and Schedule

• 053.18.1 Use a Time-Based or Event-Based Schedule for Executing Scheduler Jobs

• 053.18.1 Create Lightweight Jobs

• 053.18.1 Use Job Chains to Perform a Series of Related Tasks

• 053.19.1 Create Windows and Job Classes

• 053.19.2 Use Advanced Scheduler Concepts to Prioritize Jobs

805

Ngày đăng: 06/07/2014, 13:20

TỪ KHÓA LIÊN QUAN