oracle的kill session

在Oracle中,可以用kill session来终止一个会话进程,其基本语法结构为:

alter system kill session 'sid,serial' ;

被kill掉的session,状态会被标记为killed

SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null;
SADDR               SID    SERIAL# PADDR        USERNAME                STATUS
---------------- ---------- ---------- ---------------- ------------------------------ --------
0000000237399AC0         34        315 000000023A2B8B10 SCOTT                    INACTIVE
00000002373C5350         66        412 00000002372F35A0 SCOTT                    ACTIVE
000000023A40BA00        161       1064 000000023A2BABF0 SCOTT                    INACTIVE
0000000237447D00        162       1294 000000023A2B6A30 SCOTT                    INACTIVE
000000023A43A100        191        954 00000002372F14C0 SCOTT                    INACTIVE
000000023A465990        223        214 000000023A2B7AA0 SCOTT                    INACTIVE

SQL> alter system kill session '223,214';
System altered

SQL> select saddr,sid,serial#,paddr,username,status from v$session where username is not null;
SADDR               SID    SERIAL# PADDR        USERNAME                STATUS
---------------- ---------- ---------- ---------------- ------------------------------ --------
0000000237399AC0         34        315 000000023A2B8B10 SCOTT                    INACTIVE
00000002373C5350         66        412 00000002372F35A0 SCOTT                    ACTIVE
000000023A40BA00        161       1064 000000023A2BABF0 SCOTT                    INACTIVE
0000000237447D00        162       1294 000000023A2B6A30 SCOTT                    INACTIVE
000000023A43A100        191        954 00000002372F14C0 SCOTT                    INACTIVE
000000023A465990        223        214 00000002373343C8 SCOTT                    KILLED
6 rows selected

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值