oracle 12c在获取行锁时会自动获取表锁吗?

时间:2017-01-03 21:13:07

标签: oracle oracle12c

它在文档中说oracle 12c,在获取行锁时获取表锁。在sql server中不是这样,这是非常莫名其妙。

A row lock, also called a TX lock, is a lock on a single row of a table. A transaction acquires a row lock for each row modified by one of the following statements: INSERT, UPDATE, DELETE, MERGE, and SELECT ... FOR UPDATE. The row lock exists until the transaction commits or rolls back.

***When a transaction obtains a row lock for a row, the transaction also acquires a table lock for the table in which the row resides***. The table lock prevents conflicting DDL operations that would override data changes in a current transaction.

有人可以澄清这个吗?

1 个答案:

答案 0 :(得分:5)

发生的表锁是共享锁。同一个表上可以同时允许任意数量的共享锁:它们不会相互干扰。

他们所做的是阻止任何东西获取该表上的独占锁定:例如,更改表格的结构。