码迷,mamicode.com
首页 > 其他好文 > 详细

052-214(新增70题2018)

时间:2018-03-20 15:11:49      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:ons   ...   ued   big   overview   rmi   color   issue   upd   

User Scott has updated the salary of one of the employees in the EMPLOYEES table and has not committed the transaction.

What are the two types of locks that this scenario would lead to? (Choose two.)

A. null lock on the row being updated

B. null lock on the table containing the row

C. ROW SHARE lock for the row being updated

D. ROW EXCLUSIVE lock for the row being updated

E. shared row-exclusive lock for the row being updated

F. a shareable table lock for the table containing the row

G. exclusive table-level lock for the table containing the row

Answer: DF

  Row locks primarily serve as a queuing mechanism to prevent two transactions from modifying the same row. The database always locks a modified row in exclusive mode so that other transactions cannot modify the row until the transaction holding the lock commits or rolls back. Row locking provides the finest grain locking possible and so provides the best possible concurrency and throughput.
Overview of Automatic Locks

Table Locks (TM)

table lock, also called a TM lock, is acquired by a transaction when a table is modified by an INSERTUPDATEDELETEMERGESELECT with the FOR UPDATE clause, or LOCK TABLE statement. DML operations require table locks to reserve DML access to the table on behalf of a transaction and to prevent DDL operations that would conflict with the transaction.

A table lock can be held in any of the following modes:

  • Row Share (RS)

    This lock, also called a subshare table lock (SS), indicates that the transaction holding the lock on the table has locked rows in the table and intends to update them. A row share lock is the least restrictive mode of table lock, offering the highest degree of concurrency for a table.

  • Row Exclusive Table Lock (RX)

    This lock, also called a subexclusive table lock (SX), generally indicates that the transaction holding the lock has updated table rows or issued SELECT ... FOR UPDATE. An SX lock allows other transactions to query, insert, update, delete, or lock rows concurrently in the same table. Therefore, SX locks allow multiple transactions to obtain simultaneous SX and subshare table locks for the same table.

  • Share Table Lock (S)

    A share table lock held by a transaction allows other transactions to query the table (without using SELECT ... FOR UPDATE), but updates are allowed only if a single transaction holds the share table lock. Because multiple transactions may hold a share table lock concurrently, holding this lock is not sufficient to ensure that a transaction can modify the table.

  • Share Row Exclusive Table Lock (SRX)

    This lock, also called a share-subexclusive table lock (SSX), is more restrictive than a share table lock. Only one transaction at a time can acquire an SSX lock on a given table. An SSX lock held by a transaction allows other transactions to query the table (except for SELECT ... FOR UPDATE) but not to update the table.

  • Exclusive Table Lock (X)

    This lock is the most restrictive, prohibiting other transactions from performing any type of DML statement or placing any type of lock on the table.

052-214(新增70题2018)

标签:ons   ...   ued   big   overview   rmi   color   issue   upd   

原文地址:https://www.cnblogs.com/Babylon/p/8608800.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!