Row-level locks are primarily used to prevent two transactions from modifying the
same row. When a transaction needs to modify a row, a row lock is acquired.
There is no limit to the number of row locks held by a statement or transaction, and
Oracle does not escalate locks from the row level to a coarser granularity. Row locking
provides the finest grain locking possible and so provides the best possible
concurrency and throughput.
The combination of multiversion concurrency control and row-level locking means
that users contend for data only when accessing the same rows, specifically:
■ Readers of data do not wait for writers of the same data rows.
■ Writers of data do not wait for readers of the same data rows unless SELECT ...
FOR UPDATE is used, which specifically requests a lock for the reader.
■ Writers only wait for other writers if they attempt to update the same rows at the
A transaction acquires an exclusive row lock for each individual row modified by one
of the following statements: INSERT, UPDATE, DELETE, and SELECT with the FOR
A modified row is always locked exclusively so that other transactions cannot modify
the row until the transaction holding the lock is committed or rolled back. However, if
the transaction dies due to instance failure, block-level recovery makes a row available
before the entire transaction is recovered. Row locks are always acquired automatically
by Oracle as a result of the statements listed previously.
If a transaction obtains a row lock for a row, the transaction also acquires a table lock
for the corresponding table. The table lock prevents conflicting DDL operations that
would override data changes in a current transaction.
1. 当一个事务需要修改一行记录时, 就获得了行级锁 . 该锁主要用来阻止两个事务同时修改相同的行
3. 在执行下列语句时,事务需要获得被修改的每一数据行的排他行锁: INSERT,UPDATE,DELETE,
及使用了 FOR UPDATE 子句的 SELECT 语句
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/10599713/viewspace-990931/，如需转载，请注明出处，否则将追究法律责任。