2012-10-14 11gR2 concepts page 193 - 215

来源:互联网 发布:手机数据钱接线图 编辑:程序博客网 时间:2024/06/10 10:47


Table Locks (TM) -- TM锁
A table lock, also called a TM lock, is acquired by a transaction when a table is
modified by an INSERT, UPDATE, DELETE, MERGE, SELECT 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.

 

Mutexes -- 取代LATCH的一种内部锁
A mutual exclusion object (mutex) is a low-level mechanism that prevents an object in
memory from aging out or from being corrupted when accessed by concurrent
processes. A mutex is similar to a latch, but whereas a latch typically protects a group
of objects, a mutex protects a single object.

注意这里,MUTEX与LATCH的最大区别就是LATCH保护一组对象,而MUTEX保护的是单独的对象。

 

Mutexes provide several benefits:
 -- A mutex can reduce the possibility of contention.
Because a latch protects multiple objects, it can become a bottleneck when
processes attempt to access any of these objects concurrently. By serializing access
to an individual object rather than a group, a mutex increases availability.

 --  A mutex consumes less memory than a latch.
 -- When in shared mode, a mutex permits concurrent reference by multiple sessions.

 

Beginning of a Transaction -- 事务的开始
When a transaction begins, Oracle Database assigns the transaction to an available
undo data segment to record the undo entries for the new transaction. A transaction
ID is not allocated until an undo segment and transaction table slot are allocated,
which occurs during the first DML statement. A transaction ID is unique to a
transaction and represents the undo segment number, slot, and sequence number.

事务的开始,执行的顺序,先从UNDO申请区域,然后事物槽,之后分配事务(TRANSACTION)的ID,

它包括了回滚段的段号,槽位,序列号。


 

原创粉丝点击