• 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';
    

      

  • 相关阅读:
    Go语言
    Go语言
    electron-builder vue3 用户自定义安装目录
    提取页面中的style标签内容
    px2rpx | px转rpx
    js EventBus
    select 下拉选择多个值
    keep-alive页面缓存
    js适配移动端页面
    vue日常问题记录
  • 原文地址:https://www.cnblogs.com/eadela/p/11558642.html
Copyright © 2020-2023  润新知