forked from xtender/xt_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_pin.sql
More file actions
76 lines (71 loc) · 1.83 KB
/
find_pin.sql
File metadata and controls
76 lines (71 loc) · 1.83 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
col username for a18
col machine for a18
col obj_owner for a20
col obj_name for a30
col state for a15
col event for a40
prompt
prompt Finding library cache pin objects:
set termout off
col _pred new_val _pred noprint
select
case
when '&1' is not null and translate('&1','x0123456789','x') is null
then 'and w.sid = &1 '
else ' '
end "_PRED"
from dual;
set termout on
/*
select
distinct
ses.ksusenum sid
, ses.ksuseser serial#
, ses.ksuudlna username
, ses.ksuseunm machine
, ob.kglnaown obj_owner
, ob.kglnaobj obj_name
, pn.kglpncnt pin_cnt
, pn.kglpnmod pin_mode
, pn.kglpnreq pin_req
, w.state
, w.event
, w.wait_Time
, w.seconds_in_Wait
-- lk.kglnaobj, lk.user_name, lk.kgllksnm,
--,lk.kgllkhdl,lk.kglhdpar
--,trim(lk.kgllkcnt) lock_cnt, lk.kgllkmod lock_mode, lk.kgllkreq lock_req,
--,lk.kgllkpns, lk.kgllkpnc,pn.kglpnhdl
from
&2.x$kglpn pn
, &2.x$kglob ob
, &2.x$ksuse ses
, v$session_wait w
where
pn.kglpnhdl in
(select kglpnhdl from &2.x$kglpn where kglpnreq >0 )
and ob.kglhdadr = pn.kglpnhdl
and pn.kglpnuse = ses.addr
and w.sid = ses.indx
&_pred.
order by seconds_in_wait desc;
*/
select--+ use_hash(lk ob ses w)
distinct
ses.ksusenum sid, ses.ksuseser serial#, ses.ksuudlna username,KSUSEMNM module,
ob.kglnaown obj_owner, ob.kglnaobj obj_name
,lk.kgllkcnt lck_cnt, lk.kgllkmod lock_mode, lk.kgllkreq lock_req
, w.state, w.event, w.wait_Time, w.seconds_in_Wait
from
&2.x$kgllk lk
, &2.x$kglob ob
, &2.x$ksuse ses
, v$session_wait w
where
lk.kgllkhdl in (select kgllkhdl from &2.x$kgllk where kgllkreq >0 )
and ob.kglhdadr = lk.kgllkhdl
and lk.kgllkuse = ses.addr
and w.sid = ses.indx
&_pred.
order by seconds_in_wait desc
/