Re: get the sid,serial# of my connection?

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: Tue, 23 Dec 2008 07:55:20 -0800 (PST)
Message-ID: <28e57ec0-83da-447f-b2ef-4dd181e65522@v39g2000pro.googlegroups.com>


On Dec 23, 3:35 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> <m..._at_pixar.com> a écrit dans le message de news: U914l.8677$W06.8..._at_flpi148.ffdc.sbc.com...
> | How can I programmatically get the SID and SERIAL# for my connection
> | from a client side program?
> |
> | Many tia!
> | Mark
> |
> | --
> | Mark Harrison
> | Pixar Animation Studios
>
> SID can be gotten with SYS_CONTEXT('USERENV','SID')
> As far as I know there is no way to get SERIAL# unless you have priviledge on V$SESSION.
>
> Regards
> Michel

I would just use:
UT1 > l
  1 select username, sid, serial#
  2 from v$session
  3* where sid = (select sid from v$mystat where rownum = 1) UT1 > /

USERNAME                              SID    SERIAL#
------------------------------ ---------- ----------
MPOWEL01                               57      32395

This should work back down to at least version 8.1.7.

HTH -- Mark D Powell -- Received on Tue Dec 23 2008 - 09:55:20 CST

Original text of this message