查询当前回话信息:
SQL> select username, sid,serial#,status from v$session;
USERNAME SID SERIAL# STATUS
------------------------------ ---------- ---------- --------
1 1 ACTIVE
2 1 ACTIVE
3 1 ACTIVE
4 1 ACTIVE
5 1 ACTIVE
6 1 ACTIVE
7 1 ACTIVE
8 1 ACTIVE
9 1 ACTIVE
10 1 ACTIVE
SYS 11 3 ACTIVE
USERNAME SID SERIAL# STATUS
------------------------------ ---------- ---------- --------
SCOTT 12 1054 INACTIVE
假设要杀掉scott用户的会话
SQL> alter system kill session '12,1054';
系统已更改。
可以看到 “SCOTT 12 1054 KILLED”
如下:
SQL> select username, sid,serial#,status from v$session;
USERNAME SID SERIAL# STATUS
------------------------------ ---------- ---------- --------
1 1 ACTIVE
2 1 ACTIVE
3 1 ACTIVE
4 1 ACTIVE
5 1 ACTIVE
6 1 ACTIVE
7 1 ACTIVE
8 1 ACTIVE
9 1 ACTIVE
10 1 ACTIVE
SYS 11 3 ACTIVE
USERNAME SID SERIAL# STATUS
------------------------------ ---------- ---------- --------
SCOTT 12 1054 KILLED
也可以指明中段方式
SQL> alter system kill session '12,1054' immediate;
或者
SQL> alter system disconnect session '12,1054' immediate;
或者
SQL> alter system disconnect session '12,1054' post_transaction;
阅读(801) | 评论(0) | 转发(0) |