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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- PostgreSQL DBA(81) - Locks(FOR UPDATE SKIP LOCKED)SQL
- select for update
- 深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
- sql查詢更新update selectSQL
- PG12中新增:VACUUM命令的SKIP_LOCKED選項
- mysql update join,insert select 語法MySql
- SQLite語句(二):INSERT DELETE UPDATE SELECTSQLitedelete
- Oracle中select for update ...一些區別Oracle
- DBeaver如何生成select,update,delete,insert語句delete
- MySQL中SELECT+UPDATE併發更新問題MySql
- 記一次 MySQL select for update 死鎖問題MySql
- 1120 公交換乘
- 由select for update鎖等待問題引發的深入思考
- java-Mybatis XML 對映器(select,insert, update 和 delete)JavaMyBatisXMLdelete
- CSCI1120 Introduction to Computing
- mysql 高併發 select update 併發更新問題解決方案MySql
- Laravel5.6 如何列印 SQL?insert/update/select 列印方法總結LaravelSQL
- A. Locked Calculator
- Lombok @Locked指南Lombok
- QZ面試被問select......for update會鎖表還是鎖行lor面試
- Django筆記十三之select_for_update等選擇和更新等相關操作Django筆記
- slave-skip-errorsError
- mysqld --skip-grant-tablesMySql
- sql_slave_skip_counterSQL
- 資料庫的統計(select)確實會影響資料庫的更新(update)的資料庫
- 計算機中了locked勒索病毒怎麼辦,locked勒索病毒解密,資料恢復計算機解密資料恢復
- 計算機伺服器中了locked勒索病毒怎麼辦,locked勒索病毒解密流程計算機伺服器解密
- MySql 中有 select … for update 來加讀鎖,那麼對應地在 DocumentDB中 如何加讀鎖MySql
- select 下拉框用 Select select = new Select (element) 方法失敗
- GitHub Actions 支援 "skip ci" 了Github
- 伺服器中了locked勒索病毒怎麼處理,locked勒索病毒解密,資料恢復伺服器解密資料恢復
- Oracle中的for update 和 for update nowaitOracleAI
- 計算機伺服器中了locked勒索病毒的正確處理流程,locked勒索病毒解密計算機伺服器解密
- 計算機伺服器中了locked勒索病毒怎麼解鎖,locked勒索病毒解密步驟計算機伺服器解密
- 【日記】又有朋友去了我想去的那座城市(1120 字)
- Ijkplayer skip_frame 什麼意思?
- the --skip-grant-tables option so it cannot
- 4.pytest 之 skip 跳過
- Oracle案例07——ORA-28000: the account is lockedOracle