Skip to content

Commit e563c1d

Browse files
authored
Create parallel-query-sessions.sql
1 parent bd68851 commit e563c1d

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

parallel-query-sessions.sql

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
3+
set echo on
4+
-- Parent
5+
6+
prompt Parent Sessions
7+
WITH px_session AS (
8+
SELECT
9+
qcsid,
10+
qcserial#,
11+
MAX (degree) degree,
12+
MAX (req_degree) req_degree,
13+
COUNT ( * ) no_of_processes
14+
FROM
15+
v$px_session p
16+
GROUP BY qcsid, qcserial#)
17+
SELECT
18+
s.sid,
19+
s.username,
20+
degree,
21+
req_degree,
22+
no_of_processes,
23+
sql_text
24+
FROM
25+
v$session s
26+
JOIN
27+
px_session p
28+
ON
29+
(s.sid = p.qcsid AND s.serial# = p.qcserial#)
30+
JOIN
31+
v$sql sql
32+
ON
33+
(sql.sql_id = s.sql_id
34+
AND
35+
sql.child_number = s.sql_child_number);
36+
37+
-- Child
38+
prompt Child Sessions
39+
select
40+
41+
ps.qcsid,
42+
43+
ps.sid,
44+
45+
p.spid,
46+
47+
ps.inst_id,
48+
49+
ps.degree,
50+
51+
ps.req_degree
52+
53+
from
54+
For full scripts, download the Oracle script collection.
55+
56+
gv$px_session ps
57+
58+
join
59+
60+
gv$session s
61+
62+
on ps.sid=s.sid
63+
64+
and
65+
66+
ps.inst_id=s.inst_id
67+
68+
join
69+
70+
gv$process p
71+
72+
on p.addr=s.paddr
73+
74+
and
75+
76+
p.inst_id=s.inst_id
77+
78+
order by
79+
80+
qcsid,
81+
82+
server_group desc,
83+
84+
inst_id,
85+
86+
sid;

0 commit comments

Comments
 (0)