oracle锁的工作机制


锁的类型:

  0 - none

  1 - null (NULL)

  2 - row-S (SS)

  3 - row-X (SX)

  4 - share (S)

  5 - S/Row-X (SSX)

  6 - exclusive (X)

  0 - 没有

  1 - 空(NULL)

  2 - 行子共享模式(SS)

  3 - 行共享互斥模式(SX)

  4 - 共享模式(S)

  5 - 行子共享互斥模式

  6 - 互斥模式(X)

  DML操作引起的锁的类型和描述:

  Operation                   Lock Mode   LMODE   Lock Description

  -------------------------   ----------  ------  -----------------

  Select                      NULL        1       null

  Select for update           SS          2       sub share

  Insert                      SX          3       sub exclusive

  Update                      SX          3       sub exclusive

  Delete                      SX          3       sub exclusive

  Lock For Update             SS          2       sub share

  Lock Share                  S           4       share

  Lock Exclusive              X           6       exclusive

  Lock Row Share              SS          2       sub share

  Lock Row Exclusive          SX          3       sub exclusive

  Lock Share Row Exclusive    SSX         5       share/sub exclusive

  Alter table                 X           6       exclusive

  Drop table                  X           6       exclusive

  Create Index                S           4       share

  Drop Index                  X           6       exclusive

  Truncate table              X           6       exclusive

  -----------------------------------------------------------

  锁的兼容性,YES表示锁可以共同存在,NO表示互斥。

  NULL    SS    SX    S     SSX    X

  ------  ----  ----  ----  -----  ----

  NULL| YES     YES   YES   YES   YES    YES

  SS  | YES     YES   YES   YES   YES    NO

  SX  | YES     YES   YES   NO    NO     NO

  S   | YES     YES   NO    YES   NO     NO

  SSX | YES     YES   NO    NO    NO     NO

  X   | YES     NO    NO    NO    NO     NO


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3