总结Kill Session 的几种方法
作者:admin 日期:2010-04-19
1.在PL/SQL Developer 中 菜单"工具"--->Sessions
选择要Kill的Session,鼠标右键进行操作
2.在Toad 启动Toad,切换到Session Browser
进入以下界面,查看所有对应User所开启的Session
鼠标右键,或点击左上角的按钮对Session进行操作
3.直接用SQL语句 查找所有Session
查找及干掉锁死的代码
Select /*+RULE*/
s.machine,
s.osuser "O/S-User",
s.username "Ora-User",
s.sid "Session-ID",
s.serial# "Serial",
s.process "Process-ID",
s.status "Status",
l.name "Obj Locked",
l.mode_held "Lock Mode",
s.logon_time
FROM v$session s, dba_dml_locks l, v$process p
Where l.session_id = s.sid
AND p.addr = s.paddr --and l.name='RCV_TRANSACTIONS_INTERFACE'
order by s.logon_time
alter system kill session 'sid,serial#';
alter system kill session 'Session_ID,serial';
4.在Unix and Linux 操作系统中使用命令Kill Session
$ps -ef|grep ora_|grep -v grep
eg:$kill -9 1451
5.在Windows操作系统中使用命令Kill Session
SQL> select a.username, b.spid from v$session a, v$process b where a.paddr = b.addr and a.username ='SCOTT';
USERNAME SPID.
-------- ----
SCOTT 1456
C:\> orakill instance_name spid
C:\> orakill orcl 1456
6.在Windows中使用TASKKILL 命令
C:\>tasklist
Image Name PID Session Name Session# Mem Usage
=============== ======== ======== ============
System Idle Process 0 Console 0 16 K
oracle.exe 1456 Console 0 282,100 K
smss.exe 636 Console 0 420 K
C:\>taskkill /pid 1456 /T
7.使用NET STOP 及NET START命令
C:\>NET STOP "OracleServiceORCL"
C:\>NET START "OracleServiceORCL"
选择要Kill的Session,鼠标右键进行操作
2.在Toad 启动Toad,切换到Session Browser
进入以下界面,查看所有对应User所开启的Session
鼠标右键,或点击左上角的按钮对Session进行操作
3.直接用SQL语句 查找所有Session
复制内容到剪贴板 程序代码
Select b.sid,
b.serial#,
a.spid,
b.program,
b.osuser,
b.machine,
b.type,
b.event,
b.action,
b.p1text,
b.p2text,
b.p3text,
b.state,
c.sql_text,
b.logon_time
FROM v$process a, v$session b, v$sqltext c
Where a.addr = b.paddr
AND b.sql_hash_value = c.hash_value
AND b.STATUS = 'ACTIVE'
orDER BY a.spid, c.piece
[code]
杀进程
[code]
Alter system KILL session 'sid, serial#'
b.serial#,
a.spid,
b.program,
b.osuser,
b.machine,
b.type,
b.event,
b.action,
b.p1text,
b.p2text,
b.p3text,
b.state,
c.sql_text,
b.logon_time
FROM v$process a, v$session b, v$sqltext c
Where a.addr = b.paddr
AND b.sql_hash_value = c.hash_value
AND b.STATUS = 'ACTIVE'
orDER BY a.spid, c.piece
[code]
杀进程
[code]
Alter system KILL session 'sid, serial#'
查找及干掉锁死的代码
复制内容到剪贴板 程序代码
Select /*+RULE*/
s.machine,
s.osuser "O/S-User",
s.username "Ora-User",
s.sid "Session-ID",
s.serial# "Serial",
s.process "Process-ID",
s.status "Status",
l.name "Obj Locked",
l.mode_held "Lock Mode",
s.logon_time
FROM v$session s, dba_dml_locks l, v$process p
Where l.session_id = s.sid
AND p.addr = s.paddr --and l.name='RCV_TRANSACTIONS_INTERFACE'
order by s.logon_time
复制内容到剪贴板 程序代码
alter system kill session 'sid,serial#';
alter system kill session 'Session_ID,serial';
4.在Unix and Linux 操作系统中使用命令Kill Session
$ps -ef|grep ora_|grep -v grep
eg:$kill -9 1451
5.在Windows操作系统中使用命令Kill Session
SQL> select a.username, b.spid from v$session a, v$process b where a.paddr = b.addr and a.username ='SCOTT';
USERNAME SPID.
-------- ----
SCOTT 1456
C:\> orakill instance_name spid
C:\> orakill orcl 1456
6.在Windows中使用TASKKILL 命令
C:\>tasklist
Image Name PID Session Name Session# Mem Usage
=============== ======== ======== ============
System Idle Process 0 Console 0 16 K
oracle.exe 1456 Console 0 282,100 K
smss.exe 636 Console 0 420 K
C:\>taskkill /pid 1456 /T
7.使用NET STOP 及NET START命令
C:\>NET STOP "OracleServiceORCL"
C:\>NET START "OracleServiceORCL"
[本日志由 admin 于 2010-04-19 01:59 PM 编辑]
上一篇: Oracle EBS:PO 供应商日历的设置与启用下一篇: 2010.4 湖南.凤凰.
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: Kill Session 杀进程
相关日志:
评论: 1 | 引用: 0 | 查看次数: 11639
911seo[2010-06-17 11:37 PM | | | 59.40.113.137 | | 取消审核 | 回复]
直接使用NET STOP 比较方便。
发表评论