Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Accessing Unique Session ID
Correct, the SID and SERIAL# can be reused.
The AUDSID is the one you need for identifying uniquely a session for the lifetime of the database (not just the instance).
You can do the following:
SQL> connect testus/testus
Connected.
SQL> select userenv ('sessionid') from dual;
USERENV('SESSIONID')
2085
SQL> connect testus/testus
Connected.
SQL> select userenv ('sessionid') from dual;
USERENV('SESSIONID')
2086
These numbers are the ones you would find as AUDSID in V$SESSION.
Martin
John Alexander wrote:
>
> Do you mean the SID, Serial# combination cannot be used to uniquely identify
> a session?
>
> Sybrand Bakker <postbus_at_sybrandb.demon.nl> wrote in message
> news:960880949.21754.1.pluto.d4ee154e_at_news.demon.nl...
> > This provides the SID which is *NOT* unique.
> >
> > Regards,
> >
> > Sybrand Bakker, Oracle DBA
> >
> > "John Alexander" <jalexander_at_summitsoftwaredesign.com> wrote in message
> > news:6lf15.6949$ZZ3.18746_at_typhoon.tampabay.rr.com...
> > > This will give you the session_id:
> > >
> > > select sid,serial#,username,osuser
> > > from v$session
> > > where audsid = userenv('SESSIONID');
> > >
> > >
> > > Mary <mdellamalva_at_cetec.com> wrote in message
> > > news:8i3re1$9v8_at_journal.concentric.net...
> > > > Hello Everyone,
> > > >
> > > > I need to access the unique session id for each and every session that
> > > > connects to my Oracle (7.3.4) Database at the time of connection. I
have
> > > > been trying to tap into the DBMS_Session function: unique_session_id,
> > > > however it does not appear to have the pragma restrict_references set.
I
> > > > keep getting the following ORA Error: ORA-06571: Function
UNIQUE_SESSION_ID
> > > > does not guarantee not to update database.
> > > >
> > > > Does anyone know how to set the pragma restrict_references for this
built
in
> > > > function external to the function itself? Or, is there another way of
> > > > accessing the unique sessionid for a specific connection without
referencing
> > > > the userid which will remain the same for multiple connections?
> > > >
> > > > Any help would be appreciated
> > > >
> > > > Mary
> > > > mdellamalva_at_cetec.com
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
Received on Wed Jun 21 2000 - 00:00:00 CDT