Kill inactiv session and process automatically

Hello!
I have made a JSP (JavaServerPages) Application witch can made a connection to a oracle database. Wenn I open the connection the database generates a new process and makes a session.
Now, I have the problem, when I never close the connection, the session and the process are still alive but inactiv.
How can I automatically kill sessions and the appropriate process after a time?

Sorry, but it doesnt work. I have set sqlnet.expire_time=60, to keep alive the connection for one hour. But now I found a lot of sessions witch are inactiv and where the last SQl-quere was more than one hour...
any other idea?

Similar Messages

  • Kill a session and release all locks immediatly

    Hi,
    How to kill a session and release all locks immediately.
    Thank you
    AK

    > Actually I am working on development envrionment (Not
    production) with oracle 10g DB. What heppened is that
    I needed to replace a stored DB Package, but I
    couldn't even when I am the only connected user.
    A read lock is placed on data dictionary objects when used - that prevents someone else from changing that data dictionary object and in effect pull the carpet from beneath the feet of the process using that object.
    When trying to replace a package, it will fail if another session is busy using that package.
    As for being the only user on the database and still running into this problem - there could have been a DBMS_JOB executing that package.
    > I killed all sessions, and even next day still the
    locks are there from a session I killed 1 day
    before!
    Unusual. But a killed session can take 24+ hours to rollback. A rollback is often a lot more time consuming than the elapsed run-time of the session at the time it was killed.
    Back with Oracle 8i and prior, it was not uncommon to see a killed session lingering forever until the instance was bounced. But I have not yet seen this in 10G.
    Suggest that when you run into this situation again, you monitor the killed session to determine just what it is doing (looking at its current wait states and events) - and whether it is indeed hanging and not releasing any locks that should have been released.

  • Difference between connection, session and process

    Hi all,
    Can anyone please update me on the difference between connection,session and process.
    Thanks in advance,
    - Sri

    I got this useful note by googled in net. It describes session,connection,process gracefully.
    A connection is a physical circuit between you and the database.A connection
    might be one of many types -- most popular begin DEDICATED server and SHARED
    server. Zero, one or more sessions may be established over a given connection
    to the database as show above with sqlplus. A process will be used by a session
    to execute statements. Sometimes there is a one to one relationship between
    CONNECTION->SESSION->PROCESS (eg: a normal dedicated server connection).
    Sometimes there is a one to many from connection to sessions (eg: like
    autotrace, one connection, two sessions, one process). A process does not have
    to be dedicated to a specific connection or session however, for example when
    using shared server (MTS), your SESSION will grab a process from a pool of
    processes in order to execute a statement. When the call is over, that process
    is released back to the pool of processes.

  • Parameters session and process

    How to set session and process parameters to more 500 connections...?
    Oracle10g R2 Standard Edition
    Windows 2003 Server R2
    6GB RAM

    Windows 2003 Enterprise Edition 32bitSince it's the Enterprise edition, the os can "see" and use all the RAM. Fine.
    However, a 32-bit Windows means a virtual address space of 4GB (2^32) per process, split as 2:2 GB (system:user). So if you want a single process, for example oracle, to use most of available RAM, you would need to do some tweaking and testing.
    Why do you need to increase the processes parameter?
    What type of application is it and how is it used?
    Message was edited by:
    orafad

  • 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 user session & and update v$session

    i use
    alter system kill session 'sid,serial#) immediate.
    user session killed but not clean, V$session show that user connect
    i also want clean user session and remove form V$session
    Any one who can do this ...
    Thanks

    Hi,
    >>how remove on killing user session
    As I said before, you just need to wait ... Don't worry about. On the other hand, by finding the SPID, you can force the process to be killed instead of waiting for PMON to wake up and kill it, but I think that it is not necessary.
    Cheers
    Legatti

  • 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 advance

    You 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.

  • SGA, Sessions and process in 9i

    Dear Experts
    I have installed Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on Enterprise Linux 4 x86_64bit.
    and dell server 6850 with 16GB RAM.
    please suggest me how much i should keep maximum SGA? and sessions plus processes.
    please guide me.
    regards
    saima

    user2108660 wrote:
    Dear Experts
    I have installed Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production on Enterprise Linux 4 x86_64bit.
    and dell server 6850 with 16GB RAM.
    please suggest me how much i should keep maximum SGA? and sessions plus processes.I would echo the same what Anand has mentioned. At this moment, going for 9i and that too for 9207 is probably not the best thing to do. About the sizing of the SGA, there is no rule of thumb for it. If you have an idea about the work load, you may want to start with a reasonable amount like 3-4 gb and monitor it for some time in accordance with the work load. Once reached to a satisfactory level, you should check the performance of the system and try to re-adjust the values of the parameters again. Also read the below link,
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/memory.htm#34133
    HTH
    Aman....

  • Who killed my session & when?

    Hi Gurus,
    Could you tell me how can i check who killed my session and when two days before? Which table should i query?
    Any input will appreciated.
    Thank you.

    Yes indeed thanks.
    Some procedure like below
    CREATE OR REPLACE PROCEDURE kill_session_sp
              pn_sid IN number
            , pn_serial IN number)
    AS
    lv_user varchar2(30);
    BEGIN
      SELECT username INTO lv_user FROM v$session WHERE sid = pn_sid AND serial# = pn_serial;
    IF lv_user IS NOT NULL AND
        lv_user NOT IN  ('SYS','SYSTEM') AND
        lv_user NOT IN (SELECT user_name from privileged_users)  -- stop users kiiling System and DBA accounts
    THEN
      EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION '''||pn_sid||','||pn_serial||'''';
    ELSE
      RAISE_APPLICATION_ERROR(-20099,'Attempt to kill protected system session has been blocked for user '||lv_user);
    END IF;
    END kill_session_sp;Obviously a grant execute on that procedure should be given to someone. Normally only DBAs and production sypport may have that level of access
    Why is Oracle not record the kill processes in alert log?
    Cheers,
    Mich

  • Procedure to kill a session

    I do not have priviledge to kill the session, and i have checked the forums to create a procedure to kill the session,
    so how can i use that procedure to kill the session.
    Thanks

    If you should be allowed to kill sessions, then your DBA will grant you the ALTER SYSTEM privilege. Or, you could request your DBA to create a stored procedure for it and then grant you execute permission on that procedure. Of course, if your DBA does not choose to do this, then this is a discussion you should be having with your management.

  • Seesion and Process increase..

    Dear All
    There are 75 to 100 users are accesing the databse simulateuosly and i recently got the error of session and process exceeded ....then i tried to increase seesion and process using OEM but i got following error
    Io exception: Unknown host specified Is there any other way to do this? Can any one suggest me a best way to do this? or how do i tune it properly to acces DB without any interruption?
    Vijay
    Edited by: Vijayamurugan on Dec 8, 2010 9:29 PM

    Dear Anand
    The below is the out put v$resource_limit
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    processes                                       70             150        150
           150
    sessions                                        74             170        170
           170
    enqueue_locks                                   12              47       2380
          2380
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    enqueue_resources                              164             263        968
    UNLIMITED
    ges_procs                                        0               0          0
             0
    ges_ress                                         0               0          0
    UNLIMITED
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    ges_locks                                        0               0          0
    UNLIMITED
    ges_cache_ress                                   0               0          0
    UNLIMITED
    ges_reg_msgs                                     0               0          0
    UNLIMITED
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    ges_big_msgs                                     0               0          0
    UNLIMITED
    ges_rsv_msgs                                     0               0          0
             0
    gcs_resources                                    0               0          0
             0
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    gcs_shadows                                      0               0          0
             0
    dml_locks                                     2037            7548        748
    UNLIMITED
    temporary_table_locks                            0               3  UNLIMITED
    UNLIMITED
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    transactions                                    45             123        187
    UNLIMITED
    branches                                         0               0        187
    UNLIMITED
    cmtcallbk                                        0               1        187
    UNLIMITED
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    sort_segment_locks                               0               6  UNLIMITED
    UNLIMITED
    max_rollback_segments                           12              66        187
         65535
    max_shared_servers                               1               1  UNLIMITED
    UNLIMITED
    RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL
    LIMIT_VALU
    parallel_max_servers                             0               3         80
          3600Vijay

  • Kill idle session automatically

    dear experts
    How to kill idle/inactive session automatically, based on its idle time?
    Which parameter should change?
    what is the relation between session, process ,thread.
    plz reply

    To kill idle session automatically, create a profile with idle_time parameter and assign it to the involved user accounts:
    http://www.psoug.org/reference/OLD/profiles.html?PHPSESSID=d47ba8ea1ed4aa759bea200eb397609c
    From Concepts Guide http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/process.htm#sthref1475
    A session is a specific connection of a user to an Oracle instance through a user process
    Edited by: P. Forstmann on May 27, 2009 10:01 AM

  • 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 chattha

    Hi 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 find the killed session and machine name

    Hi,
    At the time of batch job running .somebody killed that session .let me know how to find out the particular user name db level or oslevel .from which machine they killed how to find out at OS level . but when i have set the audit_trail=os only SYSDBA user activities are audited not the other user activities.
    The server is AIX and db version 11i .provide the query for finding or os level .
    thanks,
    DBC.
    Edited by: dbc001 on Mar 26, 2013 9:48 PM

    Are you sure that somebosy had killed the session? Did you get any error regarding kill session? Is there any other errors you can see in logs?its suspect only....
    >
    How that job was scheduled?...actually we have lot of source systems, from those source system we are getting the data into BI machine, by using BI apps team process data and trigger load jobs @db
    Apps team is having database unix logins aswell as db logins to process their requests.
    Your OS admin can check the history upto some extent? Check if he has auditing enabled at OS level?we are in the process of checking with OS sysadmin.
    upto now we didnt got any clue....apps team successfully re-ran failed job.

  • Call function RFC in a loop and kill old session

    Hi,
    we have a problem with a program.
    here's a part of the code:
    DO.
        CALL FUNCTION 'YC_REFRESH_GPT_START_CM25' STARTING NEW TASK 'TEST'
          EXPORTING
            i_profile       = p_prfl
            i_werks         = p_werks
            i_arbpl_low     = s_arbpl-low
            i_arbpl_high    = s_arbpl-high
          TABLES                                              
            t_arbpl =  it_arbpl.                                
        PERFORM wait_for_refresh.
        PERFORM terminate_session.
      ENDDO.
    So the program does a call function, waits a while, then terminates the session and recalls the function.
    Apparently, like this the data should be updated.
    But in the terminate session, the session is terminated using:
    CALL 'ThUsrInfo' ID 'OPCODE'  FIELD opcode_delete_mode
                       ID 'MODE'    FIELD l_mode.
    And it works the first time, but the second time there is a dump.
    So, is there another way to achieve what this program is trying to do?
    Or is there another way to kill the session?
    Thanks!!

    Hi,
    the DLL will stay in memory as long as there is a program running which has not closed (unloaded) the DLL.
    Doing repetitive calls to the DLL is irrelevant in this context. LV opens the DLL as soon as needed and will only unload it when there is no VI in memory which has a CLN to that DLL...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • Multiple questions.

    Hello, I am having some issues with a few things regarding editing slides: Is it possible to make Captivate wait (pause) at every slide before continuing to the next one, without having any objects in it? For example, I have a powerpoint presentation

  • Blocking data in sts

    Hi all, I have a question related to STS (Status and Tracking System) in SEM-BPS and hopefully there is somebody out there that can help me: I’m having problems in blocking data in web layouts: I’ve two planning levels and in each one of them, I’m no

  • TDD JUnit

    Hi, I have been trying to use Test driven development and work back from test cases. So far I have these test cases: package poly; import static org.junit.Assert.*; import org.junit.Test; public class ConEqTest {      private int min = Integer.MIN_VA

  • Aperture 3.4.5 EXIF Export (Lens information missing)

    Hi, it seems this is not a new issue. But maybe there is a workaround. As Aperture 3.4.5 does not have tools for decent lens correction I was trying to establish a workflow with DxO Optics Pro 8.2. I prefer doing most of my adjustments with A3 based

  • Time & Pitch Machine Basics

    I read the manual, but it doesn't say anything about this: When I import a song (.mp3 or .aif file) into Logic Express 8, I double click on the track and the Sampler Editor comes on in the bottom. Then I click on the Factory tab in order to access th