This discussion is archived
2 Replies Latest reply: Oct 9, 2012 2:54 AM by user5076149 RSS

dbms CONTEXT

user771103 Newbie
Currently Being Moderated
---------------------
We are developing a web application which uses global context on Oracle 11gR2.
We see, through oracle views, that such context are not cleared until we call DBMS_SESSION.CLEAR_CONTEXT.
Our JEE expert tell us that there is no way to catch a user deconnection or timeout.
The problem is that on each reconnection we are creating a new context (with a new client_id). So, in a production environment, we will probably have a lot of context which are obsolete, and, of course, a lot of space wasted into our SGA...
So, my question are :
- Is there a way to know the last time that a global context has been accessed ?
(to clear it automatically with a job for example)
- If there is no way to catch a timeout on a JEE session, how is that used exactly used ? Are we doing something wrong ?
----------------------

This issue appears each time a session closes by another way than the proper way (click button exit)
- When the user wants to quit the application (click button exit), we are able to send an order to the database to clear the context before exit (DBMS_SESSION.CLEAR_CONTEXT)
- When the user disconnects for any other reasons (timeout, crash, and so on ..) we are not able to catch that, so the global context created by the user when he connects to the application, is still in memory.
  • 1. Re: dbms CONTEXT
    rp0428 Guru
    Currently Being Moderated
    Welcome to the forum!

    This forum is for JDBC questions only and your question should be posted in the SQL and PL/SQL forum.
    SQL and PL/SQL

    If the below does not answer your question repost it in the SQL forum.
    >
    We see, through oracle views, that such context are not cleared until we call DBMS_SESSION.CLEAR_CONTEXT.
    >
    Correct - that is what GLOBAL means.
    >
    Our JEE expert tell us that there is no way to catch a user deconnection or timeout.
    >
    Correct - plenty of things like that that cannot be caught; out of disk space, pull the plug on the server, many.
    >
    The problem is that on each reconnection we are creating a new context (with a new client_id). So, in a production environment, we will probably have a lot of context which are obsolete, and, of course, a lot of space wasted into our SGA...
    >
    Yes you will. If you repost in the SQL forum you should provide more information about what it is you are trying to do that requires global contexts to do it. Then maybe there are alternative methods that can be suggested.
    >
    - Is there a way to know the last time that a global context has been accessed ?
    (to clear it automatically with a job for example)
    >
    No - there is no 'one size fits all' solution to your problem. A job could be used to look for sessions that don't exist anymore (no longer in V$SESSION) but that begs the question of how you ID those sessions in the global context.
    >
    - If there is no way to catch a timeout on a JEE session, how is that used exactly used ? Are we doing something wrong ?
    >
    That wouldn't solve your problem anyway. As said above there are a lot of ways that 'clients' can disappear that don't necessary stop the session on the server. Start a long-running query and then pull then network cable out of the client PC. Poof! Client is gone but session continues for some time.
  • 2. Re: dbms CONTEXT
    user5076149 Newbie
    Currently Being Moderated
    No - there is no 'one size fits all' solution to your problem. A job could be used to look for sessions that don't exist anymore (no longer in V$SESSION) but that begs the question of how you ID those sessions in the global context.

    --> If it is not possible to see the last time a global context has been accessed, how can we clean up global context? There is no "connection" between an Oracle Session and a thin client .. we pass through a pool of connexion. We can't clear a context when a user is still connected ?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points