Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Track the sessions
On 06/11/2006 11:50:24 PM, Muhammed Soyer wrote:
> Hi Friends,
> I want to ask if I can track the sessions . I mean I start an oracle forms
> 6i application on my machine A session is opened for the main window.
> When I click a menu item a new window is opened and an other session is
> opened for that window . I didnt give any user information for the second
> session it takes the required login information from the first one in a way
There is an arcane and very little known view called V$SESSION. It may be used to track and obtain information about the currently connected users. If you need history, it's called "auditing". You can audit sessions by a statement which reads "AUDIT SESSION". If you don't want failed connection attempts in DBA_AUDIT_TRAIL, you can say something like "AUDIT SESSION WHENEVER SUCCESSFUL";
> .
> I wonder if I can track the second session and find who its forked from ?
Unfortunately, Oracle doesn't establish parent - child relationship among sessions. That means that there isn't a parent session or anything of the sort. Also, one session can execute one SQL at any given time. There is no concept of a multi-threaded sessions. Personally, I see Oracle RDBMS as a database management software and a TP monitor and I don't think that these entities would necessarily be an improvement. There is no need for that, at least in my opinion. Every session has a client PID which issued a connection request recorded in PROCESS field of V$SESSION. Here is what it looks like:
SQL> select sid from v$session where audsid=SYS_CONTEXT('USERENV','SESSIONID');
SID
54
SQL> select process from v$session where sid=54;
PROCESS
In the other terminal:
$ ps -fp 4316
UID PID PPID C STIME TTY TIME CMD
mgogala 4316 2608 0 00:05 pts/1 00:00:00 sqlplus
$
The V$SESSION table also has a "MACHINE" column. You can establish parent child relationship between the originating processes your self by using ps command. It's an OS relationship, not an Oracle relationship. It should be investigated by using OS tools, electric shocks, sodium pentathol and blunt object traumas.
-- Mladen Gogala http://www.mgogala.com -- http://www.freelists.org/webpage/oracle-lReceived on Sun Jun 11 2006 - 23:24:54 CDT
![]() |
![]() |