Tag: Session预览模式: 普通 | 列表

总结Kill Session 的几种方法

1.在PL/SQL Developer 中 菜单"工具"--->Sessions



选择要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#'




查找及干掉锁死的代码

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"
[/code][/code]

查看更多...

Tags: Kill Session 杀进程

分类:编程技术 | 固定链接 | 评论: 1 | 引用: 0 | 查看次数: 9086