|
Re: How to kill session? [message #88901 is a reply to message #88899] |
Thu, 05 June 2003 06:12 |
rana
Messages: 12 Registered: July 2002
|
Junior Member |
|
|
Hi,
connect as system/******* to your database .
==== killing a locked session
select 'alter system kill session '||''''||sid||','||serial#||'''',substr(machine,1,40) PC from v$session where sid in (select distinct session_id from v$locked_object).
This will give you all the locked sessions with kill session script and its related machine name. You just copy and paste the output line for which you want to kill with a semi colon mark. from machine name you can recognise the session you want to kill
For example copy this part only not whiole line
alter system kill session '20,120';
reply will be system altered. means ur session is killed
====== Killing any session
similary if you want to kill any session then
run this
select 'alter system kill session '||''''||sid||','||serial#||'''',substr(machine,1,40) PC from v$session;
This will give you all the locked sessions with kill session script and its related machine name. You just copy and paste the output line for which you want to kill with a semi colon mark. from machine name you can recognise the session you want to kill
example
alter system kill session '20,120';
hope this will help your purpose
reagrds
RANA
|
|
|
Re: How to kill session? [message #88903 is a reply to message #88899] |
Thu, 05 June 2003 09:02 |
AnotherBlue
Messages: 28 Registered: July 2001
|
Junior Member |
|
|
1. check locked session
step_1 :
select a.object_id, a.session_id, b.object_name
from v$locked_object a, dba_objects b
where a.object_id = b.object_id-- and b.object_name like 'OE%'
step_2 :
select sid, serial# from v$session
where sid =140
2.
alter system kill session '140,2829'
if it is not release then
step_1 :
SELECT p.SPID, s.sid, s.serial#
FROM V$SESSION s, V$PROCESS p
WHERE p.ADDR = s.PADDR AND
s.SID =140;
step_2 : uses system command
/usr/local/bin/top --check locked spid
kill -9 spid
|
|
|