全部博文(389)
分类: Oracle
2011-09-01 00:01:09
RESOURCE MANAGER的使用
1,清除并创建PENDING AREA
exec dbms_resource_manager.clear_pending_area();
exec dbms_resource_manager.create_pending_area();
2,创建CUNSUMER GROUP
exec dbms_resource_manager.create_consumer_group(consumer_group=>'TESTA',comment=>'r');
根据需求可以创建多个,从而把用户分开
exec dbms_resource_manager.create_consumer_group(consumer_group=>'TESTB',comment=>'r');
3,创建一个PLAN
exec dbms_resource_manager.create_plan(plan=>'PLAN1',comment=>'t');
4,为PLAN加资源限制,如并行度
exec dbms_resource_manager.create_plan_directive(plan=>'PLAN1',group_or_subplan=>'SYS_GROUP',PARALLEL_DEGREE_LIMIT_P1=>100,comment=>'a');
exec dbms_resource_manager.create_plan_directive(plan=>'PLAN1',group_or_subplan=>'OTHER_GROUPS',PARALLEL_DEGREE_LIMIT_P1=>50,comment=>'c');
exec dbms_resource_manager.create_plan_directive(plan=>'PLAN1',group_or_subplan=>'TESTA',PARALLEL_DEGREE_LIMIT_P1=>10,comment=>'b');
exec dbms_resource_manager.create_plan_directive(plan=>'PLAN1',group_or_subplan=>'TESTB’,PARALLEL_DEGREE_LIMIT_P1=>1,comment=>'b');
5,验证并提交PENDING AREA
exec dbms_resource_manager.validate_pending_area();
exec dbms_resource_manager.submit_pending_area();
6,初始化用户的RESOURCE GROUP
exec dbms_resource_manager_privs.grant_switch_consumer_group('A','TESTA',false);
exec dbms_resource_manager_privs.grant_switch_consumer_group('B’,'TESTB',false);
exec dbms_resource_manager.set_initial_consumer_group('A','TESTA');
exec dbms_resource_manager.set_initial_consumer_group('B','TESTB
');
7,启用参数,并重启DB生效
还有更简单的SIMPLE LAN
exec dbms_resource_manager.create_simple_plan(
simple_plan=>'SP',
consumer_group1=>'AB',group1_cpu=>20,
consumer_group1=>'AC',group1_cpu=>80,)
再初始化用户的RESOURCE GROUP.配置RM,完全成了一体力活.