代码拉取完成,页面将自动刷新
-- librarycache_locks.sql
-- Not written by me but through MetaLink article 169139.1
--
-- session a: exec dbms_lock.sleep(600)
-- session b: grant execute on dbms_lock to scott
--
-- session b will hang, providing data for this query
@clears
variable v_address varchar2(20)
col to_name format a30 head 'LOCKED OBJECT'
col to_owner format a30 head 'OBJECT OWNER'
col address new_value v_address
select /*+ ordered */
/*
KGLLKUSE session address
KGLLKHDL Pin/Lock handle
KGLLKMOD/KGLLKREQ Holding/requested mode
0 no lock/pin held
1 null mode
2 share mode
3 exclusive mode
KGLLKTYPE Pin/Lock
*/
w1.sid waiting_session
, h1.sid holding_session
, w.kgllktype lock_or_pin
, w.kgllkhdl address
, decode(h.kgllkmod, 0, 'None', 1, 'Null', 2, 'Share', 3, 'Exclusive', 'Unknown') mode_held
, decode(w.kgllkreq, 0, 'None', 1, 'Null', 2, 'Share', 3, 'Exclusive', 'Unknown') mode_requested
from
dba_kgllock w
, dba_kgllock h
, v$session w1
, v$session h1
where
(
(
(h.kgllkmod != 0)
and (h.kgllkmod != 1)
and ((h.kgllkreq = 0) or (h.kgllkreq = 1))
)
and
(
(
(w.kgllkmod = 0)
or (w.kgllkmod= 1)
)
and (
(
w.kgllkreq != 0)
and (w.kgllkreq != 1)
)
)
)
and w.kgllktype = h.kgllktype
and w.kgllkhdl = h.kgllkhdl
and w.kgllkuse = w1.saddr
and h.kgllkuse = h1.saddr
/
-- locate the locked objects
prompt The following SQL will locate locked objects:
prompt
prompt select to_owner,to_name from v$object_dependency where to_address = '&&v_address'
prompt
prompt ! See MetaLink article 169139.1 for more information !
prompt
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。