From: "Billy Verreynne" <vslabs@onwe.co.za>
Subject: Re: sid
Date: 1997/10/10
Message-ID: <01bcd552$c30ee8a0$ba030059@billyv.vslabs.co.za>#1/1
References: <343D5080.46FA90C0@mindspring.com>
Organization: Verreynne Software Labs
Newsgroups: comp.databases.oracle.server



Patrick Tan <ptan@mindspring.com> wrote in article
<343D5080.46FA90C0@mindspring.com>...
> How can I get sid of my current connection? I know I can get sid of all
> current users from v$session. There will be several same Oracle user
> connecting to the DB at the same time, each need to return unique sid in
> their session. Thanks.

Method 1:
Use DBMS_APPLICATION_INFO.SET_CLIENT_INFO to set the CLIENT_INFO column to
a random value in v$session. Then select your sid from v$session using
CLIENT_INFO = random value from v$session.

Method 2:
The column OSUSER contains the NetBIOS name of a Windows PC. If your PC's
NetBIOS name is PatrickT for example, you can select sid from v$session
where OSUSER equals that name. To use this method in a program (Delphi or
VB for example), use the GETCOMPUTERNAME api call to get the NetBIOS name.

Method 3:
Simply use the v$mystat table instead of v$session - it contains your
session id. :-)


regards,
Billy


