zoukankan      html  css  js  c++  java
  • oracle--事物特性、锁、

    update emp set comm = 100  where empno = 7369;
    

     使用dba用户查看事务

    ADDR                 XIDUSN    XIDSLOT     XIDSQN     UBAFIL     UBABLK     UBASQN     UBAREC STATUS           START_TIME           START_SCNB START_SCNW START_UEXT START_UBAFIL START_UBABLK START_UBASQN START_UBAREC SES_ADDR               FLAG SPACE RECURSIVE NOUNDO PTX NAME                                                                             PRV_XIDUSN PRV_XIDSLT PRV_XIDSQN PTX_XIDUSN PTX_XIDSLT PTX_XIDSQN     DSCN-B     DSCN-W  USED_UBLK  USED_UREC     LOG_IO     PHY_IO     CR_GET  CR_CHANGE START_DATE   DSCN_BASE  DSCN_WRAP  START_SCN DEPENDENT_SCN XID              PRV_XID          PTX_XID              CON_ID
    ---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------------- -------------------- ---------- ---------- ---------- ------------ ------------ ------------ ------------ ---------------- ---------- ----- --------- ------ --- -------------------------------------------------------------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ---------- ---------- ---------- ------------- ---------------- ---------------- ---------------- ----------
    00007FFB1AB14670         10         18       2737          5       1144        472         37 ACTIVE           09/21/19 10:39:55       2830945          0          2            5         1144          472           37 00007FFB204976A0       3587 NO    NO        NO     NO                                                                                            0          0          0          0          0          0          0          0          1          1          5          0         11          2 2019/9/21 1          0          0    2830945             0 0A001200B10A0000 0000000000000000 0000000000000000          0
    

      

    查看锁

    自动加锁 for uppdate

     自动加锁演示

    试探是否加锁

    select * from employee where deptid = 10 for update nowait;
    select * from employee where deptid = 10 for update wait 5;
    select * from employee where deptid = 10 for update skip locked;
    

     

    杀掉session锁用户

    查询锁(select * from v$lock;)找出sid

    根据sid找出serial#

    select sid, serial# from v$session where sid = 42;
    

      

    dba用户杀死session

    alter system kill session '42,58191';
    

      

    select * from emp e;
    
    update emp set comm = 100  where empno = 7369;
    
    rollback;
    
    select * from emp e where e.empno = 10 for update;
    
    select * from employee where deptid = 10 ;
    
    select * from employee where deptid = 10 for update;
    
    update employee set salary = 5566  where empid = 1 and deptid = 10;commit;
    
    select * from employee where deptid = 10 for update nowait;
    select * from employee where deptid = 10 for update wait 5;
    select * from employee where deptid = 10 for update skip locked;
    
    select * from v$transaction;
    
    select * from v$lock;
    
    select sid, serial# from v$session where sid = 42;
    
    alter system kill session '42,58191';
    

      

  • 相关阅读:
    Solr4.7+Tomcat7.0配置
    Solr suggest 搜索建议功能 配置问题
    Solr 通过经纬度指定范围搜索
    Quartz.net 实例
    log4net简单实例
    依赖注入(Autofac)
    设计模式_状态模式_C#
    C# XML操作
    策略模式_C#_设计模式
    STM32随记
  • 原文地址:https://www.cnblogs.com/eadela/p/11558642.html
Copyright © 2011-2022 走看看