ITPUB??ì3
12月微软Hyper-V虚拟化沙龙主题征集
ITPUB论坛 » Oracle入门与认证 » SELECT ...FOR UPDATE 与锁模式

标题: SELECT ...FOR UPDATE 与锁模式
离线 liuyi54872342



精华贴数 0
个人空间 0
技术积分 141 (12900)
社区积分 0 (1677642)
注册日期 2008-1-3
论坛徽章:0
      
      

发表于 2008-9-9 10:53 
SELECT ...FOR UPDATE 与锁模式

执行SELECT ...FOR UPDATE语句时,其Orale是为其加的什么模式的锁及加锁的顺序是怎样的?

      我在执行以上语句时,只要一执行就为其加了row exclusive模式锁(因为处理select ...for update 指定的行的其它DML(INSERT 除外)事务就排队等待而挂起),所示麻烦解释一下:

      以下是oracle帮助说明(Oracle® Database Concepts 10g Release 2 (10.2) Part Number B14220-02):

      assume that a transaction uses a SELECT statement with the FOR UPDATE clause to lock rows of a table. As a result, it acquires the exclusive row locks and a row share table lock for the table. If the transaction later updates one or more of the locked rows, the row share table lock is automatically converted to a row exclusive table lock.
同时在另一则帮助中Oracle如下描述:

        Row Share Table Locks (RS)
            A row share table lock (also sometimes 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 table lock is automatically acquired for a table when one of the following SQL statements is run:

                        SELECT ... FROM table ... FOR UPDATE OF ... ;  (这个我怎么也实现不了???)
                        LOCK TABLE table IN ROW SHARE MODE;

        A row share table lock is the least restrictive mode of table lock, offering the highest degree of concurrency for a table.

             Permitted Operations: A row share table lock held by a transaction allows other transactions to query, insert, update, delete, or lock rows concurrently in the same table. Therefore, other transactions can obtain simultaneous row share, row exclusive, share, and share row exclusive table locks for the same table.

             Prohibited Operations: A row share table lock held by a transaction prevents other transactions from exclusive write access to the same table using only the following statement:

                LOCK TABLE table IN EXCLUSIVE MODE;


只看该作者    顶部
离线 ccshen
一般会员



精华贴数 0
个人空间 0
技术积分 204 (9364)
社区积分 0 (47985)
注册日期 2001-9-26
论坛徽章:0
      
      

发表于 2008-9-9 11:28 
The Lock Mode has been changed since 9.2.0.6.
Select For Update => 1.get Table Level Mode(RX) 2.get Row Level Mode(X)


只看该作者    顶部
 
    

相关内容


CopyRight 1999-2006 itpub.net All Right Reserved.
北京皓辰广域网络信息技术有限公司. 版权所有
E-mail:Webmaster@itpub.net
京ICP证:010037号 联系我们 法律顾问