Skip to content

Commit 3696e89

Browse files
authored
Create monitorplan.sql
Monitor resource plan
1 parent 9ea145c commit 3696e89

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
-- Display information about the resource plans
2+
3+
set echo on
4+
set pause on
5+
set pagesize 1000
6+
set linesize window
7+
8+
select name, is_top_plan plan from v$rsrc_plan;
9+
10+
-- history of active plans
11+
col plan_name format a15
12+
13+
select sequence# seq, name plan_name,
14+
to_char(start_time, 'DD-mon HH24:mi') start_time,
15+
to_char(end_time, 'dd-mon hh24:mi') end_time
16+
from v$rsrc_plan_history;
17+
18+
-- display information about all resource consumer groups in the database.
19+
20+
col consumer_group format a25
21+
col comments format a70
22+
col status format a10
23+
24+
select consumer_group, comments, status
25+
from dba_rsrc_consumer_groups;
26+
27+
-- displays information about all resource consumer groups and the users and roles assigned to them
28+
29+
col grantee format a25
30+
col granted_group format a35
31+
col status format a10
32+
select * from dba_rsrc_consumer_group_privs;
33+
34+
-- displays the mapping between session attributes and consumer groups in the database
35+
36+
col value format a20
37+
col consumer_group format a25
38+
col attribute format a15
39+
40+
select attribute, value, consumer_group
41+
from dba_rsrc_group_mappings;
42+
43+
44+
-- List plan directives for ORG_PLAN
45+
46+
col plan format a15
47+
col group_or_subplan format a15
48+
col comments format a20
49+
col switch_group format a15
50+
51+
select plan, group_or_subplan, type, cpu_p1, switch_group, switch_for_call, switch_time, status, comments, mandatory
52+
from dba_rsrc_plan_directives
53+
where plan='ORG_PLAN';
54+
55+
-- List user session and group of REDEF_USER
56+
57+
col username format a20
58+
SELECT username, resource_consumer_group, status
59+
FROM v$session
60+
WHERE username = 'REDEF_USER';

0 commit comments

Comments
 (0)