-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrac_locks.sql
executable file
·44 lines (37 loc) · 1.22 KB
/
rac_locks.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
set echo off
set linesize 150
set heading on
set lines 1000
/* Script developed by Jorge Rios Blanco on 30-03-2012 */
/* Oracle locks details */
/* TATA Consultancy Services Mexico */
column blocker format a11;
column blockee format a10;
column blocker_module format a30;
column blockee_module format a30;
alter session set optimizer_mode=rule;
select a.inst_id,
a.sid,
sesa.serial#,
(select username from gv$session s where s.inst_id=a.inst_id and s.sid=a.sid) blocker,
(select module from gv$session s where s.inst_id=a.inst_id and s.sid=a.sid) blocker_module ,
' is blocking ' Is_Blocking,
b.inst_id,
b.sid,
sesb.serial#,
(select username from gv$session s where s.inst_id=b.inst_id and s.sid=b.sid) blockee,
(select module from gv$session s where s.inst_id=b.inst_id and s.sid=b.sid) blockee_module
from gv$lock a, gv$lock b, gv$session sesa, gv$session sesb
where
a.block <>0 and
b.request > 0
and a.id1 = b.id1
and a.id2 = b.id2
and sesa.sid = a.sid
and sesa.inst_id = a.inst_id
and sesb.sid = b.sid
and sesb.inst_id = b.inst_id
order by 1, 2
/
alter session set optimizer_mode=choose;
exit