ORACLE library cache lock query select Distinct/* + ordered */w1.sid waiting_session, h1.sid holding_session, w. kgllktype lock_or_pin, od. to_owner object_owner, od. to_name object_name, oc. type, decode (h. kgllkmod, 0, 'none', 1, 'null', 2, 'share', 3, 'clusive ', 'unknown') mode_held, decode (w. kgllkreq, 0, 'none', 1, 'null', 2, 'share', 3, 'clusive ', 'unknown') mode_requested, xw. KGLNAOBJ wait_ SQL, xh. KGLNAOBJ hold_ SQL from dba_kgllock w, dba_kgllock h, v $ session w1, v $ session h1, v $ object_dependency od, V $ DB_OBJECT_CACHE oc, x $ kgllk xw, x $ kgllk xh 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 And od. to_address = w. kgllkhdl And od. to_name = oc. name And od. to_owner = oc. owner And w1.sid = xw. KGLLKSNM And h1.sid = xh. KGLLKSNM And (w1. SQL _ ADDRESS = xw. KGLHDPAR And w1. SQL _ HASH_VALUE = xw. KGLNAHSH) And (h1. SQL _ ADDRESS = xh. KGLHDPAR And h1. SQL _ HASH_VALUE = xh. KGLNAHSH );