首页 > 应用开发 > IT综合 > kill session
根据EYGLE的文章自己测试了下。
[@more@]
SQL> select sid,username,status
2 from v$session
3 where username is not null;
SID USERNAME STATUS
---------- ------------------------------ --------
28 SYS ACTIVE
29 READONLY INACTIVE
SQL> select 'kill -9 '||spid from v$process
2 where addr=(select paddr from v$session where sid=&did);
Enter value for did: 29
old 2: where addr=(select paddr from v$session where sid=&did)
new 2: where addr=(select paddr from v$session where sid=29)
'KILL-9'||SPID
-----------------
kill -9 16330
SQL> !
[oracle@ctdb04 u01]$ ps -eaf|grep 16330|grep -v "grep"
oracle 16330 16288 0 10:11 ? 00:00:00 oraclesouthdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
[oracle@ctdb04 u01]$ kill -9 16330
[oracle@ctdb04 u01]$ exit
exit
SQL> select sid,username,status
2 from v$session
3 where username is not null;
SID USERNAME STATUS
---------- ------------------------------ --------
28 SYS ACTIVE
29 READONLY INACTIVE
SQL> select sid,username,status,serial#
2 from v$session
3 where username is not null;
SID USERNAME STATUS SERIAL#
---------- ------------------------------ -------- ----------
28 SYS ACTIVE 37611
SQL> alter system kill session '28,37611' immediate;
alter system kill session '28,37611' immediate
*
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9925929/viewspace-966431/ ,如需转载,请注明出处,否则将追究法律责任。