设为首页 加入收藏

TOP

Oracle快速彻底Kill掉等待会话(一)
2017-06-22 10:23:22 】 浏览:7903
Tags:Oracle 快速 彻底 Kill 等待 会话

会话1:


SQL> conn scott/scott


Connected.


SQL> 


SQL> 


SQL> update emp set empno=5566 where empno=7788;


1 row updated.


SQL> 


会话2


SQL> show user


USER is "SYS"


SQL> update scott.emp set empno=3344 where empno=7788;


会话2因为会话1没有提交,造成等待事件。


会话3


SQL> select saddr,sid,serial#,paddr,username,status from v$session where username =upper('scott') or username =upper('sys');   


SADDR                  SID    SERIAL# PADDR


---------------- ---------- ---------- ----------------


USERNAME                      STATUS


------------------------------ --------


000000008E04BD60          1          7 000000008E498608


SCOTT                          INACTIVE


000000008E7EC578        17        85 000000008E4A8058


SYS                            ACTIVE


000000008E78A0D0        50        37 000000008E4A4E48


SYS                            ACTIVE


SQL> set linesize 200


SQL> /


SQL>  select saddr,sid,serial#,paddr,username,status from v$session where username =upper('scott') or username =upper('sys'); 


SADDR                  SID    SERIAL# PADDR            USERNAME                      STATUS


---------------- ---------- ---------- ---------------- ------------------------------ --------


000000008E04BD60          1        15 000000008E498608 SCOTT                          INACTIVE


000000008E7EC578        17        85 000000008E4A8058 SYS                            ACTIVE


000000008E78A0D0        50        55 000000008E4A4E48 SYS                            ACTIVE


SQL> alter system kill session '1,15';


System altered.


kill掉会话1后,会话2的语句就提交了。


SQL> update scott.emp set empno=3344 where empno=5566;


1 row updated.


在会话1执行命令会报如下的错误


SQL>  update scott.emp set empno=7777  where empno=5566;


 update scott.emp set empno=7777  where empno=5566


*


ERROR at line 1:


ORA-00028: your session has been killed


会话3查询会话状态


select saddr,sid,serial#,paddr,username,status from v$session where username =upper('scott') or username =upper('sys');


SADDR                  SID    SERIAL# PADDR            USERNAME                      STATUS


---------------- ---------- ---------- ---------------- ------------------------------ --------


000000008E7EC578        17        85 000000008E4A8058 SYS          &nbs

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇CentOS 7.2下安装Prometheus和Gra.. 下一篇Red Hat Linux 6.4 安装 Oracle 1..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目