zoukankan      html  css  js  c++  java
  • About transaction lock and V$lock view

    你大概习惯了日常检视v$lock视图,了解实例中的锁定了阻塞情况,v$lock是一个非常有用的视图,每个dba都爱用他,我们来看看下面的例子:
    SQL> drop table youyus;
    
    Table dropped
    
    SQL> create table youyus as select rownum t1 from dual connect by level<=100;
    
    Table created
     /*首先清理环境*/
    session 134:
    SQL> update youyus set t1=t1+1 where t1>50;
    
    50 rows updated
    /*session 134 更新了表中t1>50的行*/
    
    session 131:
    SQL> update youyus set t1=t1+1;
    
    /*session 131 试图更新表中所有记录,但因为表中部分行仍被锁定着,故处于等待状态*/
    
    SQL> select * from v$lock where sid in (134,131) and type in ('TM','TX') order by SID,TYPE;
    
    ADDR     KADDR           SID TYPE        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
    -------- -------- ---------- ---- ---------- ---------- ---------- ---------- ---------- ----------
    0DD76430 0DD76460        131 TM        73547          0          3          0        802          0
    2DE665B8 2DE665F8        131 TX       196619        878          6          0        802          0
    2EF45F00 2EF45F2C        131 TX       262166        693          0          6        802          0
    0DD76430 0DD76460        134 TM        73547          0          3          0        813          0
    2DE36D04 2DE36D44        134 TX       262166        693          6          0        813          1
  • 相关阅读:
    BZOJ4327 : JSOI2012 玄武密码
    BZOJ4303 : 数列
    BZOJ1077 : [SCOI2008]天平
    BZOJ1829 : [Usaco2010 Mar]starc星际争霸
    BZOJ1770 : [Usaco2009 Nov]lights 燈
    BZOJ3012 : [Usaco2012 Dec]First!
    BZOJ4320 : ShangHai2006 Homework
    BZOJ4311 : 向量
    BZOJ3075 : [Usaco2013]Necklace
    BZOJ4304 : 道路改建
  • 原文地址:https://www.cnblogs.com/macleanoracle/p/2967382.html
Copyright © 2011-2022 走看看