A share table lock is acquired automatically for the table specified
in the following statement:
LOCK TABLE table IN SHARE MODE;
Permitted Operations: A share table lock held by a transaction allows other transactions
only to query the table, to lock specific rows with SELECT ... FOR UPDATE, or to run
LOCK TABLE ... IN SHARE MODE statements successfully. No updates are allowed by
other transactions. Multiple transactions can hold share table locks for the same table
concurrently. In this case, no transaction can update the table (even if a transaction
holds row locks as the result of a SELECT statement with the FOR UPDATE clause).
Therefore, a transaction that has a share table lock can update the table only if no other
transactions also have a share table lock on the same table.
Prohibited Operations: A share table lock held by a transaction prevents other
transactions from modifying the same table and from executing the following
statements:
LOCK TABLE table IN SHARE ROW EXCLUSIVE MODE;
LOCK TABLE table IN EXCLUSIVE MODE;
LOCK TABLE table IN ROW EXCLUSIVE MODE;
共享表锁
1. 使用LOCK TABLE table IN SHARE MODE;语句可获得共享表锁
2. 获得共享表锁后允许的操作 : 只允许其他表进行操作 , 其他事务不能对表进行更新操作
3. 获得共享表锁后禁止的操作 : 除了不允许其他事务修改表外 , 也不允许执行下列语句
...
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-991293/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10599713/viewspace-991293/