[20171123]Skip Locked and ITL slot 2.txt
[20171123]Skip Locked and ITL slot 2.txt
--//昨天看連結提到Skip Locked and ITL slot相關問題,連結
--//我自己重複測試看看:
1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.測試建立:
create table t1 (
id number(6),
modded number(6)
)
pctused 99
pctfree 0
;
insert into t1
select
rownum id,
mod(rownum,3) modded
from
all_objects
where
rownum <= 5000
;
commit;
-- gather stats at this point.
This gave me 693 rows in the first block, 2 entries in the ITL, and 10 bytes of free space so that I could not add an
ITL entry to the block.
Run the following from three different sessions – supply 0, 1, and 2 as the input parameter in turn.
--//建立3個session ,分別帶入0,1,2:
select id from t1 where modded = &1 and rownum <=100 for update skip locked;
The first two sessions will return 100 rows, the third session will (should) return no rows – even though there are no
locked rows for the given value of modded – but the first hundred rows that will be scanned cannot be locked because an
ITL entry cannot be acquired.
--//前面2個會話返回100行,而第3個會話因為ITL槽耗盡,無法分配ITL槽,查詢結果如下:
SCOTT@book> select id from t1 where modded = &1 and rownum <=100 for update skip locked;
Enter value for 1: 2
old 1: select id from t1 where modded = &1 and rownum <=100 for update skip locked
new 1: select id from t1 where modded = 2 and rownum <=100 for update skip locked
no rows selected
Remove the skip locked from the query and repeat the test – the third session will get stuck on "enq: TX – allocate
ITL entry".
--//如果刪除for update skip locked;
select id from t1 where modded = &1 and rownum <=100;
--//查詢返回100行.
select id from t1 where modded = &1 and rownum <=100 for update;
SCOTT@book> select id from t1 where modded = &1 and rownum <=100 for update;
Enter value for 1: 2
old 1: select id from t1 where modded = &1 and rownum <=100 for update
new 1: select id from t1 where modded = 2 and rownum <=100 for update
--//我的測試掛起!!檢視等待事件如下:
SYS@book> @ &r/wait
P1RAW P2RAW P3RAW P1 P2 P3 SID SERIAL# SEQ# EVENT STATUS STATE WAIT_TIME_MICRO SECONDS_IN_WAIT WAIT_CLASS
---------------- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------------------------------- -------- ------------------- --------------- --------------- --------------------
0000000054580004 00000000000A001F 000000000000599C 1415053316 655391 22940 80 59 42 enq: TX - allocate ITL entry ACTIVE WAITING 14933217 15 Configuration
SCOTT@book> select id from t1 where modded = &1 and rownum <=100 for update;
Enter value for 1: 2
old 1: select id from t1 where modded = &1 and rownum <=100 for update
new 1: select id from t1 where modded = 2 and rownum <=100 for update
select id from t1 where modded = 2 and rownum <=100 for update
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SCOTT@book> @ &r/spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
80 59 19582 DEDICATED 19583 30 27 alter system kill session '80,59' immediate;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2147644/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SELECT ... FOR UPDATE SKIP LOCKED;
- PostgreSQL DBA(81) - Locks(FOR UPDATE SKIP LOCKED)SQL
- 1120 11g select for update skip locked
- PG12中新增:VACUUM命令的SKIP_LOCKED選項
- [20231027]Index ITL Limit 2.txtIndexMIT
- [20210223]bbed itl ktbitflg 2.txt
- [20160727]行連結行遷移與ITL槽2.txt
- SELECT FOR UPDATE SKIP LOCKED --- 一個未公開但十分有用的特性
- [Vue] slot詳解,slot、slot-scope和v-slotVue
- SELECT FOR UPDATE SKIP LOCKED --- 一個未公開但十分有用的特性 zt
- ITL
- oracle ITL槽Oracle
- 深入研究ITL阻塞與ITL死鎖 作者 piner
- vue插槽slotVue
- vue slot 用法Vue
- VUE 插槽 slotVue
- [vue] 插槽 slotVue
- A. Locked Calculator
- Lombok @Locked指南Lombok
- 深入理解vue中的slot與slot-scopeVue
- 遭遇ITL死鎖
- ITL(Interested Transaction List)REST
- ITL的含義
- INDEX SKIP SCANIndex
- zt_ITL Cleanout和ITL中的事務狀態分析
- 推薦:深入研究ITL阻塞與ITL死鎖(轉載)
- Vue slot的用法Vue
- Vue 中的 slotVue
- 表的itl 屬性
- slave-skip-errorsError
- skip_unusable_indexesIndex
- 理解index skip scanIndex
- 細談 vue - slot 篇Vue
- Vue 作用域插槽slotVue
- httpd dead but subsys lockedhttpd
- vue函式元件,slot分發,只實現default slot的問題Vue函式元件
- ITL與事務處理
- enq: TX - allocate ITL entryENQ