1120 11g select for update skip locked
[20171120]11g select for update skip locked.txt
--//11G在select for update遇到阻塞時可以透過skipped locked跳過阻塞的記錄,測試看看:
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
SCOTT@book> create table empx as select * from emp ;
Table created.
2.測試:
--//session 1:
SCOTT@book> select count(*) from empx ;
COUNT(*)
------------
14
SCOTT@book> update empx set sal=sal+100 where deptno=10;
3 rows updated.
--//sesson 2:
SCOTT@book> select * from empx for update ;
--//掛起!!
--//session 1:
SCOTT@book> @ &r/viewlock
SID SERIAL# USERNAME OSUSER MACHINE MODULE LOCK_TYPE MODE_HELD MODE_REQUE LOCK_ID1 LOCK_ID2 OWNER OBJECT_TYP OBJECT_NAME BLOCK LOCKWAIT
------ ------------ ---------- ---------- ---------- ------------ --------------- ---------- ---------- ---------- ---------- ------ ---------- -------------------- ----- --------------------
80 15 SCOTT oracle xxxxxxx SQL*Plus TM DML(TM) Row-X (SX) None 90707 0 SCOTT TABLE EMPX No 0000000084C350B8
80 15 SCOTT oracle xxxxxxx SQL*Plus TX Transaction Exclusive None 589847 2894 No 0000000084C350B8
80 15 SCOTT oracle xxxxxxx SQL*Plus TX Transaction None Exclusive 655366 22646 No 0000000084C350B8
274 9 SCOTT oracle xxxxxxx SQL*Plus TX Transaction Exclusive None 655366 22646 Yes
274 9 SCOTT oracle xxxxxxx SQL*Plus TM DML(TM) Row-X (SX) None 90707 0 SCOTT TABLE EMPX No
SCOTT@book> select * from empx for update skip locked;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 1250 500 30
7566 JONES MANAGER 7839 1981-04-02 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 1981-05-01 00:00:00 2850 30
7788 SCOTT ANALYST 7566 1987-04-19 00:00:00 3000 20
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 1987-05-23 00:00:00 1100 20
7900 JAMES CLERK 7698 1981-12-03 00:00:00 950 30
7902 FORD ANALYST 7566 1981-12-03 00:00:00 3000 20
11 rows selected.
--//可以顯示沒有上lock的11條記錄.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2147454/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SELECT ... FOR UPDATE SKIP LOCKED;
- PostgreSQL DBA(81) - Locks(FOR UPDATE SKIP LOCKED)SQL
- SELECT FOR UPDATE SKIP LOCKED --- 一個未公開但十分有用的特性
- SELECT FOR UPDATE SKIP LOCKED --- 一個未公開但十分有用的特性 zt
- select for update
- select for update nowait 與 select for update 區別AI
- oracle select for updateOracle
- 關於 select ... for update 和 for update nowaitAI
- PG12中新增:VACUUM命令的SKIP_LOCKED選項
- select for update nowaitAI
- SQL update select語句SQL
- [20171123]Skip Locked and ITL slot 2.txt
- sql查詢更新update selectSQL
- Oracle中select ... for update的用法Oracle
- Default Locking for INSERT, UPDATE, DELETE, and SELECT ... FOR UPDATE (351)delete
- 深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
- MysqL_select for update鎖詳解MySql
- select for update與autocommit關係MIT
- 使用select監視update的操作
- oracle connection,select,update 工作原理Oracle
- mysql update join,insert select 語法MySql
- mysql innodb之select for update nowaitMySqlAI
- UPDATE SET = (SELECT ) 語法的總結
- Oracle中select for update ...一些區別Oracle
- SQLite語句(二):INSERT DELETE UPDATE SELECTSQLitedelete
- 【Mysql】兩條select for update引起的死鎖MySql
- 【MySQL】select for update 的Row Lock 與Table LockMySql
- Oracle 11g 報錯 ORA-28000 the account is lockedOracle
- MySQL中SELECT+UPDATE併發更新問題MySql
- update/select也可能產生buffer busy waits。AI
- DBeaver如何生成select,update,delete,insert語句delete
- 記一次 MySQL select for update 死鎖問題MySql
- MySQL 5.7 SELECT ... LOCK IN SHARE MODE|FOR UPDATE語句說明MySql
- mysql 各種級聯查詢後更新(update select).MySql
- 1120 公交換乘
- 由select for update鎖等待問題引發的深入思考
- java-Mybatis XML 對映器(select,insert, update 和 delete)JavaMyBatisXMLdelete
- Select for update/lock in share mode 對事務併發性影響