I have read that if a resource consumer group has meore than one plan directives referring to it , it may have more than one max_estimated_exec_time. The Database Resource Manager will then choose the most restrictive of all of incoming values.
can you please give me some example relating this?
Thanks
Natalia
Basically, they are saying when you have a multilevel plan, you can have some directives contributing to a resource consumer group that some from more then one plan. For example, see the graphic on:
</code>
http://docs.oracle.com/cd/B10501_01/server.920/a96521/dbrm.htm#12607 <code>
there the "other groups" get plan directives from both maildb and bugdb -- this is just describing what happens when this occurs -- what directives will be used.
My example looks like this:
lvl1 (top level plan)
/ \
/ \
/ \
max=10 lvl2a lvl2b max=100
\ /
\ /
\ /
demo res. consumer group
so, my demo resource consumer group will inherit from both lvl2a andlvl2b -- what will the max est exec time be? the minimum of 10 and 100.
Consider:
ops$tkyte@ORA920.US.ORACLE.COM> begin
2 dbms_resource_manager.create_pending_area;
3
4 dbms_resource_manager.create_plan
5 ( 'lvl1', comment => 'top level plan' );
6
7 dbms_resource_manager.create_plan
8 ( 'lvl2a', comment => 'second level plan' );
9
10 dbms_resource_manager.create_plan
11 ( 'lvl2b', comment => 'second level plan' );
12
13 dbms_resource_manager.create_consumer_group
14 ( consumer_group => 'demo', comment => 'yes it is a demo' );
15
16 dbms_resource_manager.create_plan_directive
17 ( plan => 'lvl2a',
18 group_or_subplan => 'demo',
19 comment => 'its a demo',
20 MAX_EST_EXEC_TIME => 10 ); 21
22 dbms_resource_manager.create_plan_directive
23 ( plan => 'lvl2b',
24 group_or_subplan => 'demo',
25 comment => 'its a demo',
26 MAX_EST_EXEC_TIME => 100 ); 27
28 dbms_resource_manager.create_plan_directive
29 ( plan => 'lvl1',
30 group_or_subplan => 'lvl2a',
31 comment => 'its a demo' );
32
33 dbms_resource_manager.create_plan_directive
34 ( plan => 'lvl1',
35 group_or_subplan => 'lvl2b',
36 comment => 'its a demo' );
37
38 dbms_resource_manager.create_plan_directive
39 ( plan => 'lvl1',
40 group_or_subplan => 'OTHER_GROUPS',
41 comment => 'its a demo' );
42
43 dbms_resource_manager.create_plan_directive
44 ( plan => 'lvl2a',
45 group_or_subplan => 'OTHER_GROUPS',
46 comment => 'its a demo' );
47 dbms_resource_manager.create_plan_directive
48 ( plan => 'lvl2b',
49 group_or_subplan => 'OTHER_GROUPS',
50 comment => 'its a demo' );
51 dbms_resource_manager.validate_pending_area;
52
53 dbms_resource_manager.submit_pending_area;
54
55 end;
56 /
PL/SQL procedure successfully completed.
ops$tkyte@ORA920.US.ORACLE.COM>
ops$tkyte@ORA920.US.ORACLE.COM> set echo off
Enter to continue
=================================================================
Lets create that poor end user who is to be limited and assign him to this plan
ops$tkyte@ORA920.US.ORACLE.COM> drop user low_priority cascade;
User dropped.
ops$tkyte@ORA920.US.ORACLE.COM> create user low_priority identified by x;
User created.
ops$tkyte@ORA920.US.ORACLE.COM> grant connect, resource to low_priority;
Grant succeeded.
ops$tkyte@ORA920.US.ORACLE.COM> begin
2 dbms_resource_manager_privs.grant_switch_consumer_group
3 ( 'low_priority', 'demo', TRUE );
4
5 dbms_resource_manager.set_initial_consumer_group
6 ( 'low_priority', 'demo' );
7 end;
8 /
PL/SQL procedure successfully completed.
ops$tkyte@ORA920.US.ORACLE.COM>
ops$tkyte@ORA920.US.ORACLE.COM> set echo off
Enter to continue
=================================================================
Now, we need to make the plan active
ops$tkyte@ORA920.US.ORACLE.COM>
ops$tkyte@ORA920.US.ORACLE.COM> alter system set resource_manager_plan = lvl1 scope = memory;
System altered.
ops$tkyte@ORA920.US.ORACLE.COM>
ops$tkyte@ORA920.US.ORACLE.COM> connect low_priority/x
Connected.
ops$tkyte@ORA920.US.ORACLE.COM>
ops$tkyte@ORA920.US.ORACLE.COM>
ops$tkyte@ORA920.US.ORACLE.COM> set echo off
Enter to continue
=================================================================
Now, we'll create a table, try to select from it and then see
what happens when we attempt a stupid query
low_priority@ORA920.US.ORACLE.COM>
low_priority@ORA920.US.ORACLE.COM> create table t as select * from all_objects;
Table created.
low_priority@ORA920.US.ORACLE.COM>
low_priority@ORA920.US.ORACLE.COM> analyze table t compute statistics;
Table analyzed.
low_priority@ORA920.US.ORACLE.COM>
low_priority@ORA920.US.ORACLE.COM> select count(*) from t;
COUNT(*)
----------
23638
low_priority@ORA920.US.ORACLE.COM>
low_priority@ORA920.US.ORACLE.COM> select count(*) from t,t;
select count(*) from t,t
*
ERROR at line 1:
ORA-07455: estimated execution time (9141 secs), exceeds limit
(10 secs)see how it picked 10 seconds as the limit