Oracle lock table

1. DML LOCK     

2. DDL LOCK

3. INTERNAL  

           锁                                         sql                                                       允许的锁                              

0                                                select * from tab;                                       RS  RX  S   SRX   X 

1  row share (RS)                      select * from tab for insert                         RS  RX  S   SRX             

                                                  lock tab xx in row share mode;                  禁止  X  ,同时禁止 默认的RX,update tab                                        

2  row exclusive (RX)                insert into tab ;                                           RS  RX                              

                                                  lock tab xx in row exclusive mode;            禁止   X  S  SRX   如果又默认RX ,一样禁止上RS 锁                                                

3  share ( S)                              lock tab xx in share mode;                         RS  S                     

                                                                                                                     禁止  其他用户 insert ,仅可查询          

4  share row exclusive (SRX)   lock tab xx in share row exclusive mode    RS         

                                                                                                                     禁止  X  S  SRX RX                

5  exclusive ( X )                       lock tab xx in exclusive mode                    无                                 

                                                                                                                     最强限制,不允许insert和锁定tab,仅查询

1. 如果 session1  正在update ,  alter table 会被锁住 

原文地址:https://www.cnblogs.com/jgmor/p/11386831.html