Killing Oracle Sessions
Please ignore it. By mistakely i posted this thread here.
Hi All,
I want to drop one user. If i made a attempt to drop that user, I rec'd "ORA-01940: cannot drop a user that is currently connected." error. So I checked with sessions with the username. No one is using this user. But it resists some inactive sessions.
SQL> DROP USER test cascade;
DROP USER test cascade
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
SQL>select sid,serial#,username,status from v$session where schemaname='TEST';
SID SERIAL# USERNAME STATUS
131 4026 TEST INACTIVE
143 29325 TEST INACTIVE
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
Now. I checked in v$sessions,
SQL>select sid,serial#,username,status from v$session where schemaname='TEST';
SID SERIAL# USERNAME STATUS
139 12982 AGILITY_QA INACTIVE
141 54482 AGILITY_QA INACTIVE
It shows some other inactive sessions. so i am trying to kill these 2 sessions again some inactive sessions will show.
Please assist me to fix that problem.
Message was edited by:
Moorthy GS
Try the output of the query to kill all sessions:
select 'alter system kill session '''||sid||','||'4026''' immediate;' scr
from v$session
where schemaname='TEST' and status <> 'KILLED'
Regards
RK
Similar Messages
-
How to kill oracle session?
hi there,
Aside from using tool like TOAD is there a syntax on how to kill oracle session?
pls help.
tnx...First findout the SID, Serial No for the Particular Session ( syntax is as follows )
SELECT sid, serial#,osuser, program FROM v$session;
(Killing the session on SQL Prompt)
ALTER SYSTEM KILL SESSION 'sid,serial#';
force to kill the session by adding IMMEDIATE
ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
OS Oracle Kill Session
First findout the SID, SPID for the Particular Session ( SQL syntax is as follows )
SELECT s.sid,p.spid, s.osuser ,s.program
FROM v$process p, v$session s
WHERE p.addr = s.paddr;
Windows OS Command for kill Session
orakill SID SPID
Regs,
Naresh -
Hi
Some of the tables ot locked in my database(it is 4 node RAC) so i first identified the session id and serial has to kill the session using belo query
col oracle_username for a10
col os_user_name for a10
set linesize 150
select s.sid,s.serial#,s.inst_id,l.inst_id,l.session_id,l.oracle_username,l.XIDUSN,l.XIDSLOT,l.XIDSQN,l.OBJECT_ID,
l.OS_USER_NAME,l.PROCESS,l.LOCKED_MODE
from gv$session s,gv$locked_object l
where s.sid=l.session_id
and ORACLE_USERNAME='&USERNSME';
it gaves me below result
168 202 1 1 168 TEST123 72 0 34994 35239 test123 6652 3
so i tried to kill it using below command
alter system kill session '168,202,@1' immediate;
but i m getting below error
SQL> ALTER SYSTEM KILL SESSION '168,202,@1' IMMEDIATE;
ALTER SYSTEM KILL SESSION '168,202,@1' IMMEDIATE
ERROR at line 1:
ORA-00030: User session ID does not exist.plz suggest how do i kill session in oracle racyes it is there
SQL> select sid,serial# from v$session where sid=168 and serial#=202;
SID SERIAL#
168 202
SQL> select sid,serial#,inst_id from gv$session where sid=168 and serial#=202;
SID SERIAL# INST_ID
168 202 1
SQL> alter system kill session '168,202' immediate;
alter system kill session '168,202' immediate
ERROR at line 1:
ORA-00030: User session ID does not exist.
SQL> alter system kill session '168,202,@1' immediate;
alter system kill session '168,202,@1' immediate
ERROR at line 1:
ORA-00030: User session ID does not exist. -
Clear the entry for killed/sniped session in v$session
Dear all,
In our production database(11.2.0.1.0) running on windows 2008 server many client session showing inactive from last 4-5 hour and I want to kill those session because all sessions are dedicated so for this I created a resource plan set its idle time after certain interval session status is showing killed but it is not removing entries from v$session but our client demand is it must be clear from v$session so for this i was using DOS command taskkill utility to kill particular os process so I want to know what is the smartest way to do this.This is known behavior, not an issue.
In a dedicated server environment when the session is killed and the rollback completes the process goes away so a join between v$session and v$process will fail. The v$session entry also usually goes away rather quickly, though I have seen cases where the v$session entry hung around till the instance was bounced. But normally Oracle will overlay the v$session entry with a new session using the same sid but a different serial# within seconds on a busy system.
Mark @ http://dbaspot.com/oracle-server/40419-killed-sessions.html
Metalink doc id 1023442.6 is also something confirming it.
See also below link and last reply by Mr. Braj Kishore Mahto.
http://dbaforums.org/oracle/index.php?showtopic=3039
Regards
Girish Sharma
Edited by: Girish Sharma on Nov 21, 2012 5:35 PM
So, what is best in this regard :
ALTER SYSTEM DISCONNECT SESSION
The ALTER SYSTEM DISCONNECT SESSION syntax is an alternative method for killing Oracle sessions. Unlike the KILL SESSION command which asks the session to kill itself, the DISCONNECT SESSION command kills the dedicated server process (or virtual circuit when using Shared Sever), which is equivalent to killing the server process from the operating system. The basic syntax is similar to the KILL SESSION command with the addition of the POST_TRANSACTION clause. The SID and SERIAL# values of the relevant session can be substituted into one of the following statements.
SQL> ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' POST_TRANSACTION;
SQL> ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' IMMEDIATE;
http://www.oracle-base.com/articles/misc/killing-oracle-sessions.php#disconnect_session -
How to kill concurrent request oracle session which is terminated
Dear,
In our production environment Concurrent request "Gather Schema Stats" was running 2 days. Hence we cancelled the request.
Request completed as terminated status. Unfortunately the oracle session of that concurrent request went to "Killed" status. Still utilizing CPU resource.
If we try, "alter system kill session 'SID,serial#';"
it gives below message,
ERROR at line 1:
ORA-00031: session marked for kill
Could you please provide steps to kill this oracle session.
Instance detail:
Oracle Applications R12.1
Oracle database 11.1.0.7
Thanks,
...basha
Edited by: 913932 on Jun 25, 2012 2:32 AMIn our production environment Concurrent request "Gather Schema Stats" was running 2 days. Hence we cancelled the request.
Request completed as terminated status. Unfortunately the oracle session of that concurrent request went to "Killed" status. Still utilizing CPU resource.
If we try, "alter system kill session 'SID,serial#';"
it gives below message,
ERROR at line 1:
ORA-00031: session marked for killTry "alter system kill session 'SID,serial#' immediate".
Could you please provide steps to kill this oracle session.Concurrent Processing - How to Find Database Session & Process Associated with a Concurrent Program Which is Currently Running. [ID 735119.1]
Thanks,
Hussein -
Hi,
I run a oracle query which has gone to deadlock.now i want to kill that session because it's happening frequently.How can i kill my own oracle process without needed DBA privs.
Regards
AnandDo not confuse between deadlock and hang.
See the difference.
Here a deadlock :
Session 1:
SCOTT@demo102> select empno, ename from emp25;
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
EMPNO ENAME
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected.
SCOTT@demo102> begin
2 update emp25 set ename = 'TEST' where empno=7369;
3 dbms_lock.sleep(10);
4 update emp25 set ename = '2' where empno=7499;
5 end;
6 /
PL/SQL procedure successfully completed.
SCOTT@demo102> Session 2:
SCOTT@demo102> l
1 begin
2 update emp25 set ename = 'TEST' where empno=7499;
3 dbms_lock.sleep(10);
4 update emp25 set ename = '2' where empno=7369;
5* end;
SCOTT@demo102> /
begin
ERROR at line 1:
ORA-00060: deadlock detected while waiting for resource
ORA-06512: at line 4
SCOTT@demo102> As you can see above, there is no wait, neither of both session hang, so you don't need to kill one of them.
Here a hang session :
Session 1:
SCOTT@demo102> update emp25 set ename = 'TEST' where empno=7369;
1 row updated.
SCOTT@demo102> Session 2:
SCOTT@demo102> update emp25 set ename = 'TEST' where empno=7369;=> Wait event (commit/rollback) from session 1.
If user which is owner of session1 go at home, session 2 will wait all the week-end.
You need a third session to unblock situation :
SYS@DEMO102> DECLARE
2 CURSOR lcobj_cur IS
3 select session_id
4 , oracle_username
5 , os_user_name
6 , object_id obj_id
7 , locked_mode
8 from V$LOCKED_OBJECT;
9
10 CURSOR obj_cur(p_obj_id IN NUMBER) IS
11 select owner||'.'||object_name object_name
12 , object_type
13 from dba_objects
14 where object_id = p_obj_id;
15 l_sid number;
16 l_serial number;
17 BEGIN
18 DBMS_OUTPUT.PUT_LINE(RPAD('Sid',5)||
19 RPAD('Serial',8)||
20 RPAD('O-User',10)||
21 RPAD('OS-User',10)||
22 RPAD('Owner.Object Name',45)||
23 RPAD('Object Type',35));
24
25 DBMS_OUTPUT.PUT_LINE(RPAD('-',1,'-')||
26 RPAD('-',1,'-')||
27 RPAD('-',6,'-')||
28 RPAD('-',6,'-')||
29 RPAD('-',41,'-')||
30 RPAD('-',31,'-'));
31
32 FOR lcobj IN lcobj_cur
33 LOOP
34 FOR obj IN obj_cur(lcobj.obj_id)
35 LOOP
36 select distinct sid, serial# into l_sid, l_serial from v$session where sid= lcobj.session_id;
37 DBMS_OUTPUT.PUT_LINE(RPAD(lcobj.session_id,5)||
38 RPAD(l_serial,8)||
39 RPAD(lcobj.oracle_username,10)||
40 RPAD(lcobj.os_user_name,10)||
41 RPAD(obj.object_name,45)||
42 RPAD(obj.object_type,35));
43 END LOOP;
44 END LOOP;
45 END;
46 /
Sid Serial O-User OS-User Owner.Object Name Object Type
147 121 SCOTT INKASHI\AdSCOTT.EMP25 TABLE
152 18 SCOTT INKASHI\AdSCOTT.EMP25 TABLE
PL/SQL procedure successfully completed.
SYS@DEMO102>
SYS@DEMO102> select /*+ ORDERED */
2 blocker.sid blocker_sid
3 , blocked.sid blocked_sid
4 , TRUNC(blocked.ctime/60) min_blocked
5 , blocked.request
6 from (select *
7 from v$lock
8 where block != 0
9 and type = 'TX') blocker
10 , v$lock blocked
11 where blocked.type='TX'
12 and blocked.block = 0
13 and blocked.id1 = blocker.id1
14 /
BLOCKER_SID BLOCKED_SID MIN_BLOCKED REQUEST
152 147 4 6
SYS@DEMO102>
SYS@DEMO102> alter system kill session '152,18';
System altered.
SYS@DEMO102> Then session1 will be disconnected :
SCOTT@demo102> select * from emp25;
select * from emp25
ERROR at line 1:
ORA-00028: your session has been killed
SCOTT@demo102> And session2 can continue his work :
1 row updated.
SCOTT@demo102> select * from emp25;
EMPNO ENAME JOB MGR HIREDATE SAL COMM
DEPTNO
7369 TEST CLERK 7902 17/12/80 8000
20
...Hope this help,
Nicolas. -
Situation:
Oracle Forms 9i application, with multiple oracle forms (MDI). When I call a new forms I use OPEN_FORM(v_cm_module, ACTIVATE, session, pl_id) so I create a new oracle session.
Problem:
The user open a lot of windows (oracle forms .fmx with diferent sessions each one) in the oracle forms application, when they close the browser window (X botom of the browser, mozilla, internet explorer), the session are still alive (only kill one session....the first I think).
I know that after 15 minutes oracle kill the rest of the sessions, but if the user was editing a block (locking a record), and close the browser, the table still lock 15 minutes!!!!.
Any sugestions:???
ThanksIs it necessary to create a session for each form?
If so you could do the following:
in the formsweb.cfg set the seperateframe property on true; and place some JavaScript code into the htmlafterform property:
HTMLafterForm=<script type="text/javascript"> window.moveTo(-10000, -10000); </script>
now you have a seperate frame, the browser window gets moved to a position where you can't see it ;-). when clicking the X button in the seperate frame the current form will be closed; your MDI application is still running...if you wan't you can write a JavaBean, and get the windowlisteners of the seperate frame and replace them with your own...of course you can close the Browser by right clicking and closing it in the taskbar; but that's a thing you must live with...
besides that I have no clue how to get rid of those sessions, as I don't you have any event you can act with when closing the Browser. But if so you could save every sid in every when-new-form-instance trigger (you can get it from v$mystat), and when this event occurs you could kill all those sessions (alter system kill session ....) ;-). but as far as I know that's not possible...
regards
christian -
Killing all sessions at once who are locking the objects
Hello all,
i am working in 9i Oracle RDBMS on AIX IBM OS
most of the time we face locking issue and there comes more then different 50 sessions which locking different tables.
here is my script to find out what sessions are locking what tables.
set lines 200
set pages 50000
col SID for 99999
col SERIAL# for 999999
col username format a12
col sql format a55
col event format a50
col program format a40
col MINS for 9999
col ID1 for 999999
col object_name for a35
col locktype for a8;
select /*+ ORDERED */ s.sid,s.serial#,s.status,round(s.last_call_et/60) MINS,s.program,l.ID1,d.object_name,d.object_type,l.type as locktype
from v$lock l,v$session s, dba_objects d
where l.sid = s.sid
and l.ID1 = d.object_id
and s.username = 'MULDMS'
and last_call_et > 120 and l.type <> 'TX' order by s.status,MINS,l.ID1,l.type; and the out put it gives something like
SID SERIAL# STATUS MINS PROGRAM ID1 OBJECT_NAME OBJECT_TYPE LOCKTY
8981 1069 ACTIVE 2 frmweb@Appsdms31 (TNS V1-V3) 30407 VH_BTN TABLE TM
1642 512 ACTIVE 15 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
690 1057 ACTIVE 17 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
699 1787 ACTIVE 17 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
690 1057 ACTIVE 17 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
690 1057 ACTIVE 17 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
10877 895 ACTIVE 18 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
6654 1085 ACTIVE 18 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
1912 1655 ACTIVE 18 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
10877 895 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6654 1085 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
1912 1655 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
1754 1582 ACTIVE 18 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
10877 895 ACTIVE 18 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
6654 1085 ACTIVE 18 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
10708 982 ACTIVE 19 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
5428 855 ACTIVE 19 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
10708 982 ACTIVE 19 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
5428 855 ACTIVE 19 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
10278 897 ACTIVE 20 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
6261 1056 ACTIVE 20 frmweb@appsdms12 (TNS V1-V3) 28846 AM_DOCS TABLE TM
6598 1413 ACTIVE 20 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
1312 1000 ACTIVE 20 [email protected] (TNS V1-V3) 28846 AM_DOCS TABLE TM
10278 897 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6261 1056 ACTIVE 20 frmweb@appsdms12 (TNS V1-V3) 30407 VH_BTN TABLE TM
1312 1000 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
3521 717 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6598 1413 ACTIVE 20 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
6598 1413 ACTIVE 20 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
1312 1000 ACTIVE 20 [email protected] (TNS V1-V3) 30643 VT_CHECK_INOUT TABLE TM
9131 1002 INACTIVE 2 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
4887 1040 INACTIVE 2 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
151 1982 INACTIVE 2 [email protected] (TNS V1-V3) 80224 RD_ENQEXD TABLE TM
846 988 INACTIVE 3 [email protected] (TNS V1-V3) 29228 GM_VIN TABLE TM
5364 1149 INACTIVE 3 [email protected] (TNS V1-V3) 30407 VH_BTN TABLE TM
9934 789 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
7511 1092 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
3595 1104 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
846 988 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TM
945 670 INACTIVE 3 [email protected] (TNS V1-V3) 30455 VH_PSF TABLE TMand then i have to kill the session one by one . thaat is a tedious task to do.
i want to modify this script which will give me all the kill statement and i just have to run it
can someone help me in this regard as i am weak in sql/plsql
thanks and many thanks>
i want to modify this script which will give me all the kill statement and i just have to run it
>
Karthick's script will 'kill' the sessions but before you use that script you may want to read the docs about the KILL and DISCONNECT clauses.
See the DISCONNECT SESSION and KILL SESSION clauses in the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2013.htm#sthref4724
>
DISCONNECT SESSION Clause
Use the DISCONNECT SESSION clause to disconnect the current session by destroying the dedicated server process (or virtual circuit if the connection was made by way of a Shared Sever).
The IMMEDIATE setting disconnects the session and recovers the entire session state immediately, without waiting for ongoing transactions to complete.
KILL SESSION Clause
The KILL SESSION clause lets you mark a session as terminated, roll back ongoing transactions, release all session locks, and partially recover session resources.
IMMEDIATE Specify IMMEDIATE to instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately.
>
For DISCONNECT the IMMEDIATE clause will recover the session state 'immediately'.
Using KILL, even with the IMMEDIATE clause, you are telliing Oracle to roll back any ongoing transactions and that can take a lot of time.
Make sure you are really doing the operation you want to do. If you want to get the locks released immediately you need to use 'DISCONNECT IMMEDIATE'. -
Old Oracle Session with Tomcat is not kiiling automatically
Hi,
I am facing a problem of increasing inactive oracle sessions with tomcat, Old Oracle sessions with tomcat are visible with new one.
if somebaody did not restarted tomcat gracefully, then does Oracle keep the session connected or is there any way that whenever any one restarted tomcat abnormally, Oracle session can be killed.
I had restart the database to kill session.Could you please tell me that where do i set this parameter in parameter file or sql net file and what is the recommended value, do you have any document on this.
Another thing tomcat is in other server machine and my database is in different server machine, killing process in tomcat server machine manually may not kill linux process on oracle database machine and therefore oracle sessions are still there.
Is it possible?
Edited by: user605066 on 28-Aug-2008 04:59 -
Killing User sessions and user calcs
Hi all,
We have a situation where users run their business rules during evening and at times in night.
We also have a maxl script which does aggregation and other calcs daily in night and it does not run as other calcs are launched by users.
Is it possible to kill the user session and calcs launched by users before running maxl calculation for consolidations?
I know I can do in in EAS, but want to try to do it in MAxL for automation.
Thanks in advanceYou would be better off locking people out. After you kick off the automated calc, killing sessions doesn't stop them from initiating calcs while your automated calc is running. In answer to your question, yes, you can do that in maxl.
alter system kill request all;
You have other options if you want to be more selective on what you kill.
kill request <session-id>
kill request by user
kill request on application
kill request on database
Check out the technical documentation for more info - http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/launch.html.
Kyle Goodfriend
http://www.in2hyperion.com
Please make sure to assign helpful/answered to responses if applicable - it rewards those who help and benefits the user community. -
Java hibernate oracle sessions never get closed
Hi all,
I'm opening some Oracle sessions from a java-hibernate app. When a shutdown my java-hibernate the oracle sessions remain opened, even if the java process is not seen as running with "ps -fea | grep java".
The problem is that this oracle sessions never die, they remain there and the only way to kill them is to either manually kill oracle process, or to restart the oracle instance or to restart the unix box where oracle resides.
My java/hibernate app always close the session with a final statement in the source code, no matter what.
Thanks in advanced.Hi all,
I'm opening some Oracle sessions from a java-hibernate app. When a shutdown my java-hibernate the oracle sessions remain opened, even if the java process is not seen as running with "ps -fea | grep java".
The problem is that this oracle sessions never die, they remain there and the only way to kill them is to either manually kill oracle process, or to restart the oracle instance or to restart the unix box where oracle resides.
My java/hibernate app always close the session with a final statement in the source code, no matter what.
Thanks in advanced. -
Kill the session Using Pl/sql Script
Hi,
I wrote a PL/SQL Script which kills the Specified Schema name..... the Script Run Successfully i got this output message "PL/SQL procedure successfully completed." But the Problem is in session status the status is in KILLED" state for more than 30 minutes.
Please Advice Why the Session in Killed State for more than 30 minutes and please tell me how to kill the session immediate;
I am Using Oracle DB 11g R1 and OS is Windows 2003 Server R2
My Pl/sql Script
SET SERVEROUTPUT ON;
DECLARE
KILLER1 V$SESSION.SID%TYPE;
KILLER2 V$SESSION.SERIAL#%TYPE;
CURSOR KILL_SESSION IS SELECT SID,SERIAL# FROM V$SESSION WHERE SCHEMANAME='NAME';
BEGIN
OPEN KILL_SESSION;
LOOP
FETCH KILL_SESSION INTO KILLER1,KILLER2;
EXIT WHEN KILL_SESSION%NOTFOUND;
DBMS_OUTPUT.put_line ('ALTER SYSTEM KILL SESSION '''||KILLER1||','||KILLER2||''' IMMEDAITE');
EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION'||chr(39)||KILLER1||','||KILLER2||chr(39);
END LOOP;
IF (KILLER1 > 0)
THEN
EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION'||chr(39)||KILLER1||','||KILLER2||chr(39);
END IF;
CLOSE KILL_SESSION;
END;
Thank You
ShanHello,
In fact you may use orakill it's an Oracle utility for Windows so as to Kill the thread corresponding
to the session.
It's equivalent to a kill -9 on Unix.
Please find here a link about the use of orakill:
http://articles.techrepublic.com.com/5100-10878_11-5224960.html
Hope this help.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Mar 27, 2010 5:17 PM -
AUTOMATICALLY KILL INACTIVE SESSIONS
Hi all. we are using oracle 8.1.6 on windows-2000 with 2gb ram. we facing
ora-12500 listner failed to start a dedicated server.
error and for this we made certain changes. we also added a parameter in sqlnet.ora at server side sqlnet.expire_time=10.. for automatically killing inactive sessions but it did not helped and many sessions remain in v$session. i wana know what should we do to kill inactive sessions. because i think when the sessions reach more than 300 then we face problem of listner failed. thanks for u'r valueable comments in advance as well.
best wishes
muhammad mohsin chatthaHi Nicolas, what you say is correct, but, unless the user try to do something (and receives an error),
those sessions will show up as SNIPED in V$SESSION, and never go away.
We can create a procedure to kill these sessions, something like this : 1 CREATE OR REPLACE PROCEDURE Kill_Sessions IS
2 Stmt VARCHAR2(200);
3 V_Sid VARCHAR2(30);
4 V_Serial VARCHAR2(30);
5 V_Username VARCHAR2(30);
6 CURSOR pri IS
7 SELECT Sid, Serial#, Username
8 FROM V$Session
9 WHERE Username Is Not Null
10 And Username not like 'SYS%'
11 And Status = 'SNIPED';
12 BEGIN
13 FOR usr in pri LOOP
14 V_Sid := usr.Sid;
15 V_Serial := Usr.Serial#;
16 Stmt := 'ALTER SYSTEM KILL SESSION ''' || V_Sid || ',' || V_Serial || '''';
17 Execute Immediate(Stmt);
18 END LOOP;
19* END;
20 / and execute it every minute (change 1440 to change the frequence) :SQL> Declare
2 Out_Var Int;
3 Begin
4 Dbms_Job.Submit(Out_Var,
5 'Kill_Sessions;',
6 Sysdate,
7 'Sysdate+1/1440' );
8* End;
SQL> /
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> -
How to kill the session after the user exit the ADF application
Dear all
I have a problem
The problem is the session still exist after the user close the application and the browser. I want to kill all sessions that is not active.
This is my test scenario:
1- I open IE and run my ADF application that is deployed on weblogic. http://192.168.100.17:7001/myapp/faces/login
2- At the same time I issue this SQL command to view the sessions for user 'ADFUSER' - the "ADFUSER" is the schema user.
SELECT USERNAME,STATUS FROM v$session
WHERE USERNAME = 'ADFUSER';QUERY RESULT IS
USERNAME MODULE STATUS
ADFUSER JDBC Thin Client INACTIVE3- Now the user close the browser
4- Run the SQL again and I notice that the session still exist
SELECT USERNAME,STATUS FROM v$session
WHERE USERNAME = 'ADFUSER'RESULT:
USERNAME MODULE STATUS
ADFUSER JDBC Thin Client INACTIVE5- now the user open the URL again http://192.168.100.17:7001/myapp/faces/login
6-Run the SQL again , and I notice that the old session still exists and a new session created too.
SELECT USERNAME,STATUS FROM v$session
WHERE USERNAME = 'ADFUSER'RESULT:
USERNAME MODULE STATUS
ADFUSER JDBC Thin Client INACTIVE
ADFUSER JDBC Thin Client INACTIVE
2 rows selected.and every time I login to the application , a new session is open and the old session still exist
I do not know why this happens
I want to kill old session when the user close the application.
These sessions are cleared only when i restart the weblogic domain.
here is some information about my development environment:
Jdeveloper 11.1.2.3
WebLogic Server Version: 10.3.5.0
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
thanks in advanceHi,
for performance reasons you should not use dedicated user connections to the database. Instead you use JDBC data sources (default in JDeveloper for ADF BC) that you can configure the database connection pooling for. This means that your v$session will always show a set of active session, which however are shared among users. Assuming you use ADF BC, this is what happens
- A user requests a data bound page
- The ADF BC checks out an AM and connects to the database using one of the database connections in the pool
... user work here ...
- user exits application
- ADF BC returns AM to pool and passivates pending user state (if application is left with dirty transaction)
- Database connection is available in pool as soon as AM released
This also happens between requests. Long story cut short: v$session doesn't give you a true picture
Frank -
hellow to everyone.
i am looking for help that how to kill v$session by using oracle forms?
any help or if there is any FMB please any help would be greatly appreciated.
MehwishAmmad Ahmed wrote:
ok fine but how to search for lock session and client IP?
i want when session lock and i want to search that session which is locked and want to kill that session?
how?Okay, search session which are locked you can by why you want to know the client IP?
For check the locked session with session id and serial# here is the query.
select substr ( o.owner || '.' || o.OBJECT_NAME, 1, 32 ) "LOCKED",
substr ( l.oracle_username, 1, 20 ) ouser,
'''' || substr ( l.session_id || ',' || s.serial#, 1, 12 ) || '''' sid
from sys.dba_objects o,
sys.V_$LOCKED_OBJECT l,
v$session s
where o.OBJECT_ID = l.OBJECT_ID
and s.username = l.oracle_username
and s.sid = l.session_id;But before executing this make sure that user can access v$session.
Normally form does not allow to use data dictionary view in forms. So, you can use as a view in form for the above query.
Do you have any Module?Why? it is better to work from start and learn more instead of getting something ready.
-Ammadbe aware to automate this process.... when user updates any data and stay on the record this view will give you that table is lock also database will show that session is active.
Maybe you are looking for
-
Getting mandatory attribute validation error when the value is defaulted through customization
Hi I am getting Mandatory attribute validation error when we default the value through customization. In the UI we have attribute called Last Name which is mandatory at EO level. Customer wanted to default Last name to some value, through page compos
-
IE launch failure: "Could not load file/URL specified"
My user is receiving this failure : "An error occurred while launching/running the application. Category: Invalid Argument error Could not load file/URL specified: C:\Documents and Settings\XXX\Local Settings\Temporary Internet Files\Content.IE5\GDMV
-
Actually I can drag all other text based application like ever-notes. Only safari dosen't work properly. I couldn't drag at the desired location and even if it is dragged, I can't remove dragging line by simply touching the non-dragged area. This pro
-
Hi, I have a file named programa.class and I would like to copy its byte content into a byte array, so I can send it later through the COM1 port. Can someone give me an example of how can this be done? Thanks in advance.
-
I have tried to set up my company's owa 2010 for the past month on my curve. They upgraded from 2003. Every time I attempt to set up 2010 it takes about 10 tries through the setup program. Finally, I receive the congratulations email and receive all