點(diǎn)擊上方“IT那活兒”公眾號(hào),關(guān)注后了解更多內(nèi)容,不管IT什么活兒,干就完了!!!
Enqueue(隊(duì)列)是一種共享內(nèi)存結(jié)構(gòu),用于串行訪問(wèn)數(shù)據(jù)庫(kù)資源,關(guān)聯(lián)一個(gè)會(huì)話或事務(wù),它是Oracle訪問(wèn)數(shù)據(jù)庫(kù)對(duì)象的lock,每個(gè)試圖鎖住資源的會(huì)話,將會(huì)獲得這個(gè)資源的Enqueue。
CF(Controlfile Enqueue)
DX (Distributed Transaction Enqueue)
FB (Block Format Enqueue)
HW( High Water Enqueue)
JS (Job Scheduler Enqueue)
RO (Fast Object Reuse Enqueue)
SQ( Sequence Cache Enqueue)
ST( Space Transaction Enqueue)
TO( Temporary Table Object Enqueue)
TT (Tablespace Operations Enqueue)
US( Undo Segment Enqueue)等等
LOCK: TX "Transaction Enqueue".
enq: TX - contention
enq: TX - row lock contention
enq: TX - allocate ITL entry
enq: TX - index contention
update u1.test1 set name=MM where id=5
update u1.test1 set name=zz where id=5
SELECT sid,type,id1,id2,lmode,request FROM v$lock WHERE type=TX;
SID TYPE ID1 ID2 LMODE REQUEST
52 TX 524288 13106 6 0
59 TX 524288 13106 0 6
SELECT DECODE(request,0,Holder: ,Waiter: )||sid sess,
id1, id2, lmode, request, type
FROM V$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type FROM V$LOCK WHERE request>0)
ORDER BY id1, request
SESS ID1 ID2 LMODE REQUEST TYPE
Holder: 52 524288 13106 6 0 TX
Waiter: 59 524288 13106 0 6 TX
SID:52是blocker,正持有該鎖;
SID:59是waiter,等待獲得該鎖.
SELECT DECODE(LV, 1, Holder: || S.SID, Waiter: || S.SID) SESS_STATUS,S.USERNAME,OBJECT_NAME,S.inst_id,S.SID,s.serial#, DECODE(L.LMODE, 0, None, 1, Null, 2, Row-S (SS), 3, Row-X (SX), 4, Share, 5, S/Row-X (SSX), 6, Exclusive, TO_CHAR(L.LMODE)) LOCK_MODE, TRUNC(L.CTIME / 3600) || : || TRUNC(MOD(L.CTIME, 3600) / 60) || : || MOD(L.CTIME, 60) CTIME, S.STATUS, S.MACHINE, S.SQL_ID, Q.SQL_TEXT
FROM (SELECT /*+ NO_MERGE */(3-LEVEL) LV, INST_ID, SID, TYPE, LMODE, CTIME
FROM (SELECT /*+ NO_MERGE */A.INST_ID, A.SID, A.TYPE, A.LMODE, A.REQUEST,
CASE
WHEN REQUEST = 0 THEN ID1
END ID1,
CASE
WHEN REQUEST > 0 THEN ID1
END ID3,
A.CTIME
FROM GV$LOCK A
WHERE A.TYPE <> MR) START WITH REQUEST > 0 CONNECT BY PRIOR ID3 = ID1 ) L,
GV$SESSION S,
GV$PROCESS P,
dba_objects O,
GV$SQL Q
WHERE L.SID = S.SID
AND L.INST_ID = S.INST_ID
AND S.INST_ID = P.INST_ID(+)
AND S.PADDR = P.ADDR(+)
AND S.ROW_WAIT_OBJ# = O.OBJECT_ID(+)
AND S.SQL_ID = Q.SQL_ID(+)
GROUP BY DECODE(LV, 1, Holder: || S.SID, Waiter: || S.SID), S.INST_ID,S.SID,s.serial#, S.USERNAME, O.OBJECT_NAME, L.TYPE, L.LMODE, L.CTIME, S.STATUS, S.MACHINE,S.SQL_ID,Q.SQL_TEXT;
SESS_STATUS USERNAME OBJECT_NAME INST_ID SID SERIAL# LOCK_MODE CTIME STATUS MACHINE SQL_ID SQL_TEXT
Holder: 52 U1 1 52 54450 Exclusive 0:34:15 INACTIVE WORKGROUPDREAM
Waiter: 59 U1 TEST1 1 59 50489 None 0:34:6 ACTIVE WORKGROUPDREAM 2btf137sycbdh update u1.test1 set name=zz where id=5
select decode(request,0,Holder,Waiter) req ,s.inst_id , s.sid, s.serial#,p.spid,s.status, id1, id2, lmode, request, l.type, ctime, s.sql_id, s.event#,s.event,s.last_call_et
from gv$lock l
join gv$session s on l.sid=s.sid and l.inst_id=s.inst_id
join gv$process p on s.paddr=p.addr and p.inst_id=s.inst_id
where (id1, id2, l.type) in
(select id1, id2, type from gv$lock where request>0 )
order by id1, ctime desc, request;
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/129495.html
摘要:但是,還有一種隊(duì)列叫優(yōu)先隊(duì)列,元素的添加和移除是依賴優(yōu)先級(jí)的。分類優(yōu)先隊(duì)列分為兩類最小優(yōu)先隊(duì)列最大優(yōu)先隊(duì)列最小優(yōu)先隊(duì)列是把優(yōu)先級(jí)的值最小的元素被放置到隊(duì)列的最前面代表最高的優(yōu)先級(jí)。那么最小優(yōu)先隊(duì)列排序應(yīng)該為,,,。 一、定義 前面我們學(xué)習(xí)了棧的實(shí)現(xiàn),隊(duì)列和棧非常類似,但是使用了不同的原則,而非后進(jìn)先出。 隊(duì)列是遵循FIFO(First In First Out,先進(jìn)先出)原則的一組有序...
隊(duì)列的定義 隊(duì)列是遵循先進(jìn)先出原則的一組有序的項(xiàng),與棧的不同的是,棧不管是入棧還是出棧操作都是在棧頂操作,隊(duì)列則是在隊(duì)尾添加元素,隊(duì)頂移除,用一個(gè)圖來(lái)表示大概是這樣事的:showImg(https://segmentfault.com/img/remote/1460000018133039?w=584&h=294);用一個(gè)更形象的例子就是:排隊(duì)服務(wù),總是先排隊(duì)的人會(huì)先接受服務(wù),當(dāng)然不考慮插隊(duì)的情況...
摘要:隊(duì)列是一種先進(jìn)先出,的數(shù)據(jù)結(jié)構(gòu)。隊(duì)列的另外一項(xiàng)重要操作是讀取隊(duì)頭的元素。通常的操作定義一個(gè)空隊(duì)列,無(wú)參數(shù),返回值是空隊(duì)列。刪除隊(duì)列頭部的數(shù)據(jù)項(xiàng),不需要參數(shù),返回值是被刪除的數(shù)據(jù),隊(duì)列本身有變化。 隊(duì)列是一種列表,不同的是隊(duì)列只能在隊(duì)尾插入元素,在隊(duì)首刪除元素。隊(duì)列用于存儲(chǔ)按順序排列的數(shù)據(jù),先進(jìn)先出,這點(diǎn)和棧不一樣,在棧中,最后入棧的元素反而被優(yōu)先處理。可以將隊(duì)列想象成在銀行前排隊(duì)的人群...
摘要:隊(duì)列是遵行先進(jìn)先出原則的一組有序的項(xiàng)。優(yōu)先隊(duì)列是默認(rèn)隊(duì)列的變種,它的元素的添加和移除是基于優(yōu)先級(jí)的。如此循環(huán),直至隊(duì)列的長(zhǎng)度等于,返回勝者行。同時(shí),還掌握了很著名的優(yōu)先隊(duì)列循環(huán)隊(duì)列這兩種結(jié)構(gòu)。 《學(xué)習(xí)JavaScript數(shù)據(jù)結(jié)構(gòu)與算法》讀書(shū)筆記。 隊(duì)列是遵行FIFO(First In First Out, 先進(jìn)先出)原則的一組有序的項(xiàng)。隊(duì)列再尾部添加新元素,并從頂部移除元素。 在現(xiàn)實(shí)中...
摘要:隊(duì)列是一種列表不同的是隊(duì)列只能在隊(duì)尾插入元素在隊(duì)首刪除元素是一種先進(jìn)先出的數(shù)據(jù)結(jié)構(gòu)隊(duì)列被用在很多地方比如提交操作系統(tǒng)執(zhí)行的一系列進(jìn)程打印任務(wù)池等一些仿真系統(tǒng)用隊(duì)列來(lái)模擬銀行或雜貨店排隊(duì)的顧客隊(duì)列的操作主要有兩種操作向隊(duì)尾中插入新元素入隊(duì)刪除 隊(duì)列是一種列表, 不同的是隊(duì)列只能在隊(duì)尾插入元素, 在隊(duì)首刪除元素. 是一種 先進(jìn)先出 的數(shù)據(jù)結(jié)構(gòu). 隊(duì)列被用在很多地方, 比如提交操作系統(tǒng)執(zhí)行的...
閱讀 1353·2023-01-11 13:20
閱讀 1699·2023-01-11 13:20
閱讀 1211·2023-01-11 13:20
閱讀 1902·2023-01-11 13:20
閱讀 4161·2023-01-11 13:20
閱讀 2751·2023-01-11 13:20
閱讀 1397·2023-01-11 13:20
閱讀 3664·2023-01-11 13:20