Skip to content

Commit 62bc54c

Browse files
authored
Create plan.sql
create a resource plan.
1 parent 3696e89 commit 62bc54c

File tree

1 file changed

+29
-0
lines changed
  • data-platform/core-converged-db/resource-manager/scripts

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- Create a resource plan ORG_PLAN with directives for SYS_GROUP, OTHER_GROUP, LOWER_GROUP and REDEF_GROUP
2+
-- REDEF_GROUP switches automatically any session in LOWER_GROUP if a session exceeds 30 seconds.
3+
-- The session is returned to its original group after the offending top call is complete.
4+
-- Run planon.sql to activate the plan
5+
6+
begin
7+
dbms_resource_manager.clear_pending_area();
8+
dbms_resource_manager.create_pending_area();
9+
10+
DBMS_RESOURCE_MANAGER.create_plan(plan => 'ORG_PLAN', comment=>'Limit CPU for redefinition');
11+
DBMS_RESOURCE_MANAGER.create_plan_directive(plan => 'ORG_PLAN', group_or_subplan => 'REDEF_GROUP', comment => 'For redefinition', cpu_p1 => 30, SWITCH_GROUP=>'LOWER_GROUP', SWITCH_TIME =>30, switch_for_call=>true);
12+
DBMS_RESOURCE_MANAGER.create_plan_directive(plan => 'ORG_PLAN', group_or_subplan => 'OTHER_GROUPS', comment => 'Default', cpu_p1=> 30);
13+
DBMS_RESOURCE_MANAGER.create_plan_directive(plan => 'ORG_PLAN', group_or_subplan => 'SYS_GROUP', comment => 'SYS', cpu_p1 => 30);
14+
DBMS_RESOURCE_MANAGER.create_plan_directive(plan => 'ORG_PLAN', group_or_subplan => 'LOWER_GROUP', comment => 'LOWER GROUP', cpu_p1 =>10, utilization_limit=>10);
15+
16+
DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
17+
DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
18+
END;
19+
/
20+
21+
-- Monitor the resource plan
22+
23+
set linesize window
24+
select * from v$rsrc_plan;
25+
26+
select sequence# seq, name plan_name,
27+
to_char(start_time, 'DD-mon HH24:mi') start_time,
28+
to_char(end_time, 'dd-mon hh24:mi') end_time
29+
from v$rsrc_plan_history;

0 commit comments

Comments
 (0)