Aflred
Aflred

Reputation: 4593

Does oracle 12c aquire automatically a table lock when it aquires a row lock?

It says on the documentation that oracle 12c, aquires a table lock when a row lock is aquired.That is not so in sql server, it is very baffling.

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.

Can somebody elucidate this?

Upvotes: 2

Views: 139

Answers (1)

Matthew McPeak
Matthew McPeak

Reputation: 17934

The table lock that occurs is a shared lock. There can be any number of shared locks allowed on the same table at the same time: they do not interfere with one another.

What they do do is prevent anything from acquiring an exclusive lock on that table: say, to change the structure of the table.

Upvotes: 5

Related Questions