前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >oracle--事物特性、锁、

oracle--事物特性、锁、

作者头像
eadela
发布2019-09-29 16:07:28
7010
发布2019-09-29 16:07:28
举报
文章被收录于专栏:eadelaeadela
代码语言:javascript
复制
update emp set comm = 100  where empno = 7369;

 使用dba用户查看事务

代码语言:javascript
复制
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

自动加锁演示

试探是否加锁

代码语言:javascript
复制
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#

代码语言:javascript
复制
select sid, serial# from v$session where sid = 42;

dba用户杀死session

代码语言:javascript
复制
alter system kill session '42,58191';
代码语言:javascript
复制
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';
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-09-21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档