码迷,mamicode.com
首页 > 数据库 > 详细

oracle--事物特性、锁、

时间:2019-09-21 12:56:57      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:name   stat   mic   pen   control   xid   employee   time   png   

技术图片

技术图片

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‘;

  

 

 

 

 

oracle--事物特性、锁、

标签:name   stat   mic   pen   control   xid   employee   time   png   

原文地址:https://www.cnblogs.com/eadela/p/11558642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!