Kill Session through Script

Hi ..
any one can tell me how to kill session through Script in Oracle Open Script..?

Do you mean how to stop the current virtual user or stop all the virtual users in the OLT session?
I previously posted this on how one virtual user can stop itself.
Re: How to stop single VU, java-code

Similar Messages

  • Kill session through batch file but with DELAY/SLEEP

    respected forum members,
    i have a database 9i release 2 on windows server 2003.
    as we r working in a territory where load shedding (electricity failure) is big problem intervaly. as users r working so there computer shutdown while they are working when there is power failure.
    about 250 sessions are opened in peak hours and i want to kill these sessions.
    so i want to write a batch file which kill session but at the same time I WANT TO PUT DELAY IN THE BATCH FILE which delay for 2 seconds after killing 20 sessions.
    can any body help me to write such a batch file which delays for 2 seconds after killing 20 sessions. HOW to insert DELAY/SLEEP in batch file.
    thanks

    I'm not sure I understand the point of this script. If the power fails and the server goes down, obviously all sessions will be killed. If the power fails and the client goes down leaving database sessions, you would generally want to enable dead connection detection or limit the idle time of a session in the profile so that Oracle can automatically kill those sessions. Manually killing sessions should be a last resort.
    If you really want to write this sort of script, could the batch file simply call DBMS_LOCK.SLEEP to implement the delay? Or do you literally mean that you only want the delay to come from an operating system call?
    Justin

  • Kill session script error

    Hello,
    I have create kill session script but while execute getting error. find the below scripts.
    (script name is t.sh)
    sqlplus -s '/as sysdba' << EOF
    alter user test account lock;
    spool kill_session.sql
    set heading off;
    select 'alter system kill session ' || '''' || sid || ',' || serial# || '''' || ' immediate;' from v$session
    where username ='TEST';
    spool off;
    *@$ORACLE_HOME/scripts/kill_session.sql*
    EOF
    Error:_
    *[oracle@indpund0201 scripts]$ ./t.sh*
    User altered.
    select 'alter system kill session ' || '''' || sid || ',' || serial# || '''' || ' immediate;' from v
    ERROR at line 1:
    ORA-00942: table or view does not exist
    Please suggest.

    RK wrote:
    select 'alter system kill session ' || '''' || sid || ',' || serial# || '''' || ' immediate;' from v$session
    where username ='TEST';
    The $ character has a special meaning in shell scripting. The shell will read it as follows:
    .. from v${session}
    where:
      $session = environment variableAs there is no such variable the code will be parsed as follows:
    .. from vAnd thus result in the following error (table/object called v does not exist):
    select 'alter system kill session ' || '''' || sid || ',' || serial# || '''' || ' immediate;' from v
    ERROR at line 1:
    ORA-00942: table or view does not exist
    Solution - escape the $ character as follows:
    .. from v\$sessionIt should work...

  • Killing a user session through API

    Hi,
    I want to create a procedure for killing user sessions.
    Following is the code
    create or replace procedure kill_session (sess_no number,serial_no number)
    as
    v_sid number;
    v_serial number;
    V_flag char := 'U';
    begin
    v_sid := sess_no;
    v_serial := serial_no;
    dbms_output.put_line(v_sid||v_serial);
    select 'S' into v_flag from sys.v_$session where sid=v_sid and serial#=v_serial;
    dbms_output.put_line(v_flag);
    --exception
    --when no_data_found then
    -- dbms_output.put_line('No session');
    if v_flag ='S' then
    dbms_output.put_line('true');
    execute immediate 'alter system kill session ''v_sid,v_serial'' ';
    end if;
    end;
    It return error : ORA-00026: missing or invalid session ID
    But I am passing valid sid and serial#.
    Again When I am executing
    begin
    execute immediate 'alter system kill session ''64,6677''' ;
    end;
    It works fine. What is the problem,can anyone suggest .
    Regards,
    Neeraj

    Hi Justin,
    Thanks for your reply. I have verified the right number of quotes,still it doesn't work. Please look.
    declare
    2 v_sid number :=42;
    3 v_serial number :=26633;
    4 begin
    5 EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION '' || v_sid || ',' || v_session || ''';
    6 end;
    7 /
    EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION '' || v_sid || ',' || v_session || ''';
    ERROR at line 5:
    ORA-06550: line 5, column 62:
    PLS-00103: Encountered the symbol "," when expecting one of the following:
    . ( * @ % & = - + ; < / > at in is mod not rem return
    returning <an exponent (**)> <> or != or ~= >= <= <> and or
    like between into using || bulk
    The symbol ". was inserted before "," to continue.

  • Killed sessions

    Hi,
    I kill a session with the commands:
    select username, sid, serial#, status from v$session where username like 'RION%'
    alter system kill session 'sid, serial#'
    and if I give again the first select command at the status column appears KILLED. I want not to have KILLED in the status column.
    Thank you,
    Mihaela

    hi all,
    As u know you are seeing the status of at v$session view as killed, I wanna confirm that this will exists in two senario.
    When a Session is in inactive state and a kill command on that session is issued then the "status" column of v$session will be updated as killed as to indicate/mark as it is killed, and the "server " column will be updated as psuedo. when the user again try to connect to the session user will receive 0ra-00028 error and the entry will be removed from v$session.
    Another senario is that the transaction is at its half way, either in commiting or at the roleback stage for that partucular session then also you can find that the v$table is updated as above.
    more information, go through the documentation, at the Server Process handling section.
    i hope it cleared your confussion,

  • Alter system kill session always gives ORA-00030

    Hello
    Im writing a tool for oracle and one of its features requires killing user session (Im connecting with JDBC). The database Im testing on is 11.2.0.2.
    I find the sid and the serial# without problems, than I issue the "alter system kill session 'x,y' immediate" command.
    So far so good, but I always get an ORA-00030 error saying this session cannot be found.
    I double check and the session does exist in the database.
    Because I want the tool to make the kill, killing via the OS is not an option.
    Its doesn't look like a permission problem because it gives the same error even when connected as system.
    Whats wrong ? does this kill command work at all ? Whats its limitations ?
    Thanks
    Guy Shilo
    Edited by: user13266377 on Jun 9, 2011 1:15 AM

    user13266377 wrote:
    Hello
    Im writing a tool for oracle and one of its features requires killing user session (Im connecting with JDBC). The database Im testing on is 11.2.0.2.
    I find the sid and the serial# without problems, than I issue the "alter system kill session 'x,y' immediate" command.
    So far so good, but I always get an ORA-00030 error saying this session cannot be found.
    I double check and the session does exist in the database.
    Because I want the tool to make the kill, killing via the OS is not an option.
    Its doesn't look like a permission problem because it gives the same error even when connected as system.
    Whats wrong ? does this kill command work at all ? Whats its limitations ?
    Thanks
    Guy Shilo
    Edited by: user13266377 on Jun 9, 2011 1:15 AMyou cannot kill the session already killed or disconnected from the session.
    refer the link:- this may help you to write scripts to kill session using dbms_scheduler
    Grant restricted and kill sessions.

  • Trace File Created Upon Execution of "alter system kill session sid, serial# immediate;"

    A problem within a third-party application is causing it to create and abandon Oracle sessions. At times three hundred or more abandoned sessions accumulated in the instance. The software company is working on the problem. Oracle's background processes will get rid of those sessions after several hours, but at times there were so many they caused the server to start using paging space. We wrote a SQL*Plus script to identify the abandoned sessions and kill them with command "alter system kill session <sid, serial#> immediate;". We automated the execution of the script a week ago. Today I noticed that in my udump directory an Oracle trace file has been created each time our script kills a session. A single trace file is created regardless of how many sessions are killed. No errors appear in the trace file.
    Is the creation of these trace files an indication that problems have occurred or are they there for information only?
    Since I know how and why the sessions are being killed, is it safe to ignore the trace files?
    Thank you,
    Bill

    The OS is AIX 5.2. The database server is 10.2.0.2. We are in the processing of upgrading to AIX 7.1 and database server 11.2.0.3.6.
    The script does not enable tracing for the SQL*Plus session.
    Below is the alert log message from a session killed at 11:22, and the corresponding trace file created at that same time:
    From alert_<sid>.log: 
    Wed Jul 31 11:22:01 2013
    Immediate Kill Session#: 1119, Serial#: 59885
    Immediate Kill Session: sess: 70000014dc4a7e0 OS pid: 267254
    /u02/admin/EXPRESS/udump $ ls -l express_ora_113358.trc
    -rw-r----- 1 oracle dba 2276 Jul 31 11:22 express_ora_113358.trc
    /u02/admin/EXPRESS/udump $ pg express_ora_113358.trc
    Dump file /u02/admin/EXPRESS/udump/express_ora_113358.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/product/10.2.0
    System name: AIX
    Node name: navis
    Release: 2
    Version: 5
    Machine: 0005CD8C4C00
    Instance name: EXPRESS
    Redo thread mounted by this instance: 1
    Oracle process number: 225
    Unix process pid: 113358, image: oracleEXPRESS@navis
    *** ACTION NAME:() 2013-07-31 11:22:01.181
    *** MODULE NAME:(SQL*Plus) 2013-07-31 11:22:01.181
    *** SERVICE NAME:(EXPRESS.WORLD) 2013-07-31 11:22:01.181
    *** SESSION ID:(1723.61000) 2013-07-31 11:22:01.181
    SO: 70000014d44d278, type: 2, owner: 0, flag: INIT/-/-/0x00
    (process) Oracle pid=463, calls cur/top: 0/700000139166298, flag: (0) -
    int error: 0, call error: 0, sess error: 0, txn error 0
    (post info) last post received: 108 0 4
    last post received-location: kslpsr
    last process to post me: 70000014d36c398 1 6
    last post sent: 0 0 24
    last post sent-location: ksasnd
    last process posted by me: 70000014d36c398 1 6
    (latch info) wait_event=0 bits=0
    Process Group: DEFAULT, pseudo proc: 70000014d6aec00
    O/S info: user: oracle, term: UNKNOWN, ospid: 267254
    OSD pid info: Unix process pid: 267254, image: oracleEXPRESS@navis
    Short stack dump:
    ksdxfstk+002c<-ksdxcb+04e4<-sspuser+0074<-00004CB0<-nttrd+0120<-nsprecv+0750<-ns
    rdr+0114<-nsdo+1714<-nsbrecv+0040<-nioqrc+04a8<-opikndf2+0688<-opitsk+088c<-opii
    no+0990<-opiodr+0adc<-opidrv+0474<-sou2o+0090<-opimai_real+01bc<-main+0098<-__st
    art+0090
    Dump of memory from 0x070000014D2CC3B0 to 0x070000014D2CC5B8
    70000014D2CC3B0 00000004 00000000 07000001 39DA8D48 [............9..H]
    70000014D2CC3C0 00000010 0003139D 07000001 39166298 [............9.b.]
    70000014D2CC3D0 00000003 0003139D 07000001 4C73D508 [............Ls..]
    70000014D2CC3E0 0000000B 0003139D 07000001 4DC4A7E0 [............M...]
    70000014D2CC3F0 00000004 00031291 00000000 00000000 [................]
    70000014D2CC400 00000000 00000000 00000000 00000000 [................]
    Repeat 26 times
    70000014D2CC5B0 00000000 00000000 [........]
    Thanks,
    Bill

  • Batch kill session

    Hi,
    How can I batch kill session?
    I have two related sessions in v$session by column client_info.
    When os administrator kill the process, only kill the first session. I need to execute automatically the procedure:
    psid number;
    pserial# number;
    session_killed EXCEPTION;
    PRAGMA EXCEPTION_INIT(session_killed, -31);
    begin
    SELECT sid, serial# into psid, pserial# FROM v$session WHERE client_info = p_client_info;
    EXECUTE IMMEDIATE 'alter system kill session ' || '''' || psid || ',' || pserial# || ''' immediate';
    DBMS_OUTPUT.PUT_LINE('Killing user ' || psid || ', ' || pserial#);
    EXCEPTION
    WHEN session_killed THEN
    DBMS_OUTPUT.PUT_LINE('The session ' || psid || ' has been marked to be killed');
    END;
    It is possible?
    Help me, pls
    Beatriz

    Hi!
    Pierre Forstmann, I have proven it, but I think that the trigger does not activate when kill becomes from the os.
    -Sri, I'm executing a mapping of owb in production through a function.
    The function generates one session in the data base and the call to mapping another one.
    When mapping takes much, the production operators make kill process by means of a tool (controlM) that only suspends the first session.
    But mapping continues executing itself because it runs under the other session.
    I have related both sessions to identify them through the column client_info of v$session, now Its necessary automatically kill the second session, but I don't know how to do it.
    thanks to all

  • Kill session and process

    Hi,
    There are many answers in this forum related with my question but could not complete answer.
    I have problem with process count in db. Firstly I killed sessions
    alter system kill session 'xxx,yyyy';
    and then queried v$session. The status of sessions were changed as killed but in v$process it showed that the count of process same as before.
    So I decided to create profile and set idle time.
    select * from v$resource_limit
    RESOURCE_NAME     CURRENT_UTILIZATION     MAX_UTILIZATION     INITIAL_ALLOCATION     LIMIT_VALUE
    processes     459     466            500            500
    sessions     459     467            555            555
    select * from dba_profiles
    PROFILE     RESOURCE_NAME     RESOURCE_TYPE     LIMIT
    myUser_PROFILE     IDLE_TIME     KERNEL     2880 (2 days)
    select username,profile from dba_users
    USERNAME    PROFILE
    myUser      myUser_PROFILE
    select
           p.spid,
           s.username,
           s.sid,
           s.serial#,
           to_char(s.logon_time, 'Dy dd Mon HH24:MI:SS') start_time,
           s.status
      from V$PROCESS p, V$SESSION s
    where s.paddr = p.addr
       and s.username is not null;
    SPID     USERNAME     SID     SERIAL#     START_TIME     STATUS
    3880     myUser     181     102     Wed 24 Mar 19:37:10     SNIPED
    5135     myUser     71     190     Wed 24 Mar 20:41:00     SNIPED
    5259     myUser     422     3,794     Wed 24 Mar 20:47:31     SNIPED
    5666     myUser     189     197     Wed 24 Mar 21:15:35     SNIPED
    32109     myUser     421     3,746     Thu 25 Mar 21:57:07     SNIPED
    32371     myUser     344     10,518     Thu 25 Mar 22:16:31     SNIPED
    32395     myUser     65     28     Thu 25 Mar 22:18:01     SNIPED
    32518     myUser     35     205     Thu 25 Mar 22:23:37     SNIPED
    19703     myUser     40     18     Fri 26 Mar 21:03:24     SNIPED
    19870     myUser     242     106     Fri 26 Mar 21:12:05     SNIPED
    19965     myUser     212     11,276     Fri 26 Mar 21:19:10     SNIPED
    23054     myUser     215     535     Sat 27 Mar 00:08:01     SNIPED
    23668     myUser     17     6,237     Sat 27 Mar 00:48:25     SNIPED
    26200     myUser     218     1,323     Sat 27 Mar 03:44:07     SNIPED
    18830     myUser     388     256     Sun 28 Mar 00:40:10     INACTIVE
    18894     myUser     177     461     Sun 28 Mar 00:41:35     INACTIVE
    18954     myUser     357     36     Sun 28 Mar 00:45:09     INACTIVE
    19124     myUser     52     325     Sun 28 Mar 00:53:38     INACTIVE
    14697     myUser     448     2     Mon 29 Mar 00:06:05     INACTIVE
    14741     myUser     447     6     Mon 29 Mar 00:07:53     INACTIVE
    14786     myUser     449     3     Mon 29 Mar 00:09:26     INACTIVE
    8678     SYS     461     10,762     Mon 29 Mar 10:45:00     ACTIVEI think pmon should kill process related with killed session but it does not.
    Please explain me how it happens,what should I do.
    After while I will again get error as 'ORA-00020: maximum number of processes (%s) exceeded'
    Thanks in advance
    Edited by: catastrophe on Mar 28, 2010 11:24 PM

    Hi,
    When you are killing an oracle session which is created by some unix shell script you need to follow some other steps to kill that session.
    When you kill a session using sid and serial# it kills only oracle session but does not frees unix process associated with that session.
    To perform it correctly pls do the following.
    SQL> ;
      1  select s.sid, s.serial#, p.pid, p.spid, p.username
      2  from   v$session s, v$process p
      3  where  s.paddr=p.addr
      4* and    s.username='SCOTT'
    SQL> /
           SID    SERIAL#        PID SPID         USERNAME
           530      32662         40 14258        oracle
           462      47581         49 17344        kuldeep
    $ ptree 17344
    4974  /usr/sbin/inetd -s
      10598 in.telnetd
        10603 login -p -d /dev/pts/1 -h 172.24.242.183
          10671 -ksh
            14814 sqlplus /
              17344 oracleffdt01 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))Kill deepest process in ptree output i.e. 17344
    Edited by: [email protected] on Mar 29, 2010 4:25 PM

  • Killing sessions

    hi,
    i am using oracle 11gr1 in windows server service pack2.i have generated scripts to kill the user using alter system kill session 'sid,serial# and then dropping the same user.But at times i get the error that cannot drop user who is currently connected .when i check the state of the user in v$session it is in killed state.i want to avoid this and kill the user perfectly.
    can anyone tell me the solution or suggestion for this????
    thanks in advance
    Edited by: 793097 on Dec 17, 2010 3:12 AM

    A remote session open a server session, this is the one you must kill.
    I'm not sure, but when you kill a session the relation between v$process and v$session disapear. Then all you can do is wait.
    Perhaps I am wrong. Try this,
    select 'kill -9 ' || b.spid from v$process where b.addr = <v$session killed paddr>;
    And run the kill in OS, if OS is linux or unix...
    I am very sorry that we never help to you...
    793097 Newbie
    Handle:      793097
    Status Level:      Newbie (15)
    Registered:      Sep 6, 2010
    Total Posts:      94
    Total Questions:      57 (49 unresolved)
    Read this http://forums.oracle.com/forums/ann.jspa?annID=718

  • Alter & Kill Session

    Dear all,
    when i tried to execute following alter statement it takes almost 10 hours to complete.
    ALTER TABLE JUST_STAT_10
    ADD ( ZKK_00985 VARCHAR2(20) DEFAULT ' ' NOT NULL,
    ZKK_0988 VARCHAR2(96) DEFAULT ' ' NOT NULL,
    ZKK_0989 NUMBER(6) DEFAULT 0 NOT NULL,
    TKK_0990 VARCHAR2(15) DEFAULT ' ' NOT NULL);
    Then I killed session, but the script is now terminating over 12 hours and more.
    Is there a way to kill this session without any consequences to the table?
    Table stats:
    Size: 284 GB
    Num_rows:245.222.121
    Table_lock:ENABLED
    Number_Extents:290.975
    Thanks in advance,
    Regards,
    Robert

    user8660054 wrote:
    Dear all,
    when i tried to execute following alter statement it takes almost 10 hours to complete.
    ALTER TABLE JUST_STAT_10
    ADD ( ZKK_00985 VARCHAR2(20) DEFAULT ' ' NOT NULL,
    ZKK_0988 VARCHAR2(96) DEFAULT ' ' NOT NULL,
    ZKK_0989 NUMBER(6) DEFAULT 0 NOT NULL,
    TKK_0990 VARCHAR2(15) DEFAULT ' ' NOT NULL);
    Then I killed session, but the script is now terminating over 12 hours and more.
    Is there a way to kill this session without any consequences to the table?
    Table stats:
    Size: 284 GB
    Num_rows:245.222.121
    Table_lock:ENABLED
    Number_Extents:290.975
    Thanks in advance,
    Regards,
    RobertYou should check what Oracle was waiting for during execution of SQL.
    select event, p1, p2, p3 from v$session_wait where SID = YOUR_SID

  • ALTER SYSTEM KILL SESSION 에 대하여(ORA-30)

    제품 : ORACLE SERVER
    작성날짜 : 1997-07-30
    ALTER SYSTEM KILL SESSION 에 대하여
    --- Problem
    사용자는 다음과 같은 상황에서 session 을 kill 하려는 시도를 하게 된다.
    1. os 에는 process 가 존재하지 않지만, v$session 에는 active 로 존재하고
    있을 경우
    2. shadow process 는 살아 있는데, client machine 을 rebooting 한 경우
    3. session 이 걸고 있던 lock 을 release 해야 할 경우
    4. OS 나 Oracle 의 자원을 지나치게 많이 사용하여 성능을 저하시키는
    process
    그런데, alter system kill session ('sid, serial#'); 후에 다음과 같은
    에러가 발생할 경우가 있다.
    ora-00030, 00000, "user session ID does not exist"
    // *Cause:  The user session id no longer exists, probably because the
    // session was logged out.
    // *Action: Use a valid session ID.
    --- 원인과 대책
    kill session을 할 수 없는 이유는 PMON이 이미 이 session을 delete하고 있는
    중이기 때문이다. 즉, PMON 이 dead session 을 clean-up 하고 있는 중에는
    serial number의 값이 증가한다.
    문제는 PMON이 process를 kill하는 시간인데, transaction의 크기에 따라,
    PMON의 rollback 시간이 결정된다. 먼저 PMON은 dead process를 찾아내어,
    이 process가 사용한 resource 를 release하는 시도를 한다.
    PMON은 계속 이 작업을 시도하다가 마침내, free buffer의 부족으로 더 이상
    resource를 free-up 하지 못하게 된다.
    이 때, 이 process를 delete하고 있다는 message를 trace file에 출력하는데,
    이것은 process를 delete하는 데 필요한 resource(data cache 내의 free buffer)
    의 부족으로 위의 작업이 지연되고 있다는 의미이다.
    PMON이 process 를 clean-up 할 때 걸리는 시간은, 5분에서 24 시간까지 소요
    될 수 있다. 문제는 이 process가 hold 하고 있는 lock으로 인해 특정 작업이
    수행되지 못하는 데 있다. MTS 를 사용할 때는 configuration MTS setting,
    sqlnet.expire_time 사용)에 따라 다르지만, clean-up 작업을 하는데 72 시간이
    소요된 경우도 있다.
    아직까지는 PMON이 작업을 마칠 때까지 기다리는 방법 또는 db를 restartup하는
    방법 밖에는 없다.
    --- PMON 의 작업
    PMON은 network failure 나 기타의 원인으로 생긴 old process connection을
    clean-up 하는 역할을 한다. 그런데, PMON 은 clean-up 해야 하는 connection
    중에 정해진 개수 만큼의 transaction 을 rollback 할 수 있는데, 이 값은
    initSID.ora 의 cleanup_rollback_entries(default = 20) 에 의해 결정된다.
    예를 들어, 1000 개의 uncommitted update가 있다면, 일정한 시간마다
    cleanup_rollback_entries 의 개수 만큼의 record 만 rollback 할 수 있으므로
    이 작업 동안에 lock 은 그대로 유지된다.
    PMON 은 위의 작업 이외에 DB maintenance 역할이 있으므로, 위의 rollback 이
    비교적 빠르게 처리되지 못할 수도 있다. 이러한 rollback을 빠르게 처리하기
    위하여 cleanup_rollback_entries 를 늘릴 수도 있다. 그러나, 그 만큼 일정
    시간 동안 PMON 의 작업이 많아지게 되므로, 다른 사용자들의 작업 요청이
    느려지게 되는 trade-off 가 있으므로, 신중히 고려한 후에 수정하는 것이
    바람직하다.
    alter system kill session 에 의해서도 위와 같이 rollback 이 이루어지는데,
    이 session 이 완전히 clean-up 되기 전까지 v$session, v$process에 남아 있게
    된다.
    --- ALTER SYSTEM KILL SESSION 을 하기 전에 ...
    kill session 을 원할 경우는 다음의 순서대로 작업하는 것이 좋다.
    1. kill the user process first
    2. wait for 3 - 4 minutes
    3. query v$session
    4. if any information find in v$session, query v$lock
    like
    select count(*) from v$lock where SID ='sid';
    위의 count(*) 가 0 이 아니라면, 아직 PMON 이 rollback을 끝내지 못한 경우
    이므로 다시 얼마 후에 v$lock 을 조회하여 lock 의 개수가 감소하였는지
    반복적으로 확인한다.
    만약, 이 값이 전혀 변하지 않았다면, ALTER SYSTEM KILL SESSION 을 수행하고
    v$session, v$lock을 query 하여 변화가 있는지 확인하여 변화가 있다면,
    좀 더 기다린다.
    그래도, v$lock 의 count(*) 가 0 이 되지 않을 경우, 마지막으로 수행할 수
    있는 유일한 방법은 instance 를 restartup 하는 것이다.

    user13266377 wrote:
    Hello
    Im writing a tool for oracle and one of its features requires killing user session (Im connecting with JDBC). The database Im testing on is 11.2.0.2.
    I find the sid and the serial# without problems, than I issue the "alter system kill session 'x,y' immediate" command.
    So far so good, but I always get an ORA-00030 error saying this session cannot be found.
    I double check and the session does exist in the database.
    Because I want the tool to make the kill, killing via the OS is not an option.
    Its doesn't look like a permission problem because it gives the same error even when connected as system.
    Whats wrong ? does this kill command work at all ? Whats its limitations ?
    Thanks
    Guy Shilo
    Edited by: user13266377 on Jun 9, 2011 1:15 AMyou cannot kill the session already killed or disconnected from the session.
    refer the link:- this may help you to write scripts to kill session using dbms_scheduler
    Grant restricted and kill sessions.

  • Kill Session with MaxL

    Hi all,
    I need to do a script to kill sessions with Maxl with more than 8 hours of activity, no matter what they are doing.
    The problem is that some sessions are hangs and logout don't work, also not work 'set session_idle_limit' parameter.
    Sorry for my english, i'm from Spain. Best regards.

    I have a thought on this, as the MAXL script can be automated using essmsh command in batch script. What I will do is run the script for the MAXL script to do following :- "display session on database app_name.db_name"; say now, spool the output to filename1 and schedule the next execution of this script as required say after 8 hours and spool the output to filename2.
    Then I will compare the contents of the both files and if any matching records exists for the user, that is the one who is active on database for more than 8 hours.
    Hope this solves your requirement..

  • How to kill session in forms

    In my application I want to kill session if any user
    is idle for 2 minutes.
    I am using oracle forms 6i and database oracle 9i

    You have to use D2KWutil.pll
    In when new form instance write the following code
    declare
    hWind PLS_INTEGER;
    CheckTimer TIMER;
    begin
    hWind := get_window_property(FORMS_MDI_WINDOW,WINDOW_HANDLE);
    Win_API_Session.Timeout_Start_Timer(hWind);
    CheckTimer := Create_Timer('CheckTimeout',1000,repeat);
    end;
    and in when timer expired trigger write the following code
    begin
    if upper(get_application_property(TIMER_NAME)) = 'CHECKTIMEOUT' then
                   :timer.t1 := Win_api_session.Timeout_Get_Inactive_Time;     
    if :timer.t1 > 120 then -- timer is a block and t1 is text item (don't assign a canvas to it, make it invisible)
    Win_API_Session.timeout_delete_timer;
    exit_form (NO_VALIDATE);
    end if;
    end if;
    end;
    hope this helps !!

  • Urgent-how to run 'alter system kill session 'sid, serial#' in form 6i ?

    I want to write a procedure in Form 6i so that user can kill the session by herself.
    I know kill session sql is 'alter system kill session 'sid, serial#'', however, I fould that I can only run it it sql plus screen, how can I run it in Form or in Stored procedure?
    Urgent....Please!

    try using Forms_ddl('alter system......'); in the forms. it will execute the dml statements in the form.
    zaibi.

Maybe you are looking for