ITPub博客

首页 > Linux操作系统 > Linux操作系统 > lock table tablename in exclusive mode与select * from tablename for update

lock table tablename in exclusive mode与select * from tablename for update

原创 Linux操作系统 作者:qgw521 时间:2008-10-28 13:18:42 0 删除 编辑

lock table tablename in exclusive mode是在表级锁定,select * from tablename for update是行级锁定.比如:

session1:

SQL>lock table A in exclusive mode;

session2:

SQL>select * from A  where 1=0 for update;

虽然是没有拿到任何数据,但还是进入了等待资源状态,因为lock table是锁住了整张表,所以对这张表的任何DML操作都会进入等待。

session1:

SQL>rollback;

SQL>select * from A for update;

session 2:

SQL>rollback;

SQL>select * from A where 1=0 for update这样就不会进入锁定状态。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13387766/viewspace-478467/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 有关oracle text
请登录后发表评论 登录
全部评论

注册时间:2008-06-06

  • 博文量
    128
  • 访问量
    304329