Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Posts
    1,074

    Unanswered: Current session details

    Can you tell from within the current session what it's sid and serial# are? Something like:

    Code:
    connect forbesc@dev
    password: ******
    
    connected
    
    select * from v$session where sid = CURRENT_SID and serial# = CURRENT_SERIAL#
    Oracle has to track this information so it can tell the difference between two or more sessions owned by the same logon, and so I'm hoping to be able to find this information as well.

    -Chuck

  2. #2
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Hi,

    Code:
    select * 
    from   v$session 
    where  audsid = userenv('SESSIONID')
    Hth
    Bill
    Please don't email me directly with questions. I've probably just got home from the pub and cannot guarantee the sanity of my answers. In fact, I can't believe I actually made it home.

  3. #3
    Join Date
    Feb 2005
    Location
    Leesburg, VA
    Posts
    42
    You can get sid, serial# from v$session based on billm's query. You can also use SYS_CONTEXT instead of USERENV, which will give you a ton more things associated with the current user:

    http://www.psoug.org/reference/sys_context.html
    Steven Karam
    Oracle 10g Certified Master
    Web: OrclDBA.com
    Email: steve@orcldba.com

  4. #4
    Join Date
    Dec 2003
    Posts
    1,074
    Thanks, that's exactly what I'm after.

    So will the AUDSID be unique enough to use it as the equivalent of a primary key in order to uniquely identify a connection?

    The documentation on v$session doesn't mention anything about it's uniqueness, as it does for the SERIAL# field.

    -Chuck

  5. #5
    Join Date
    Dec 2003
    Posts
    1,074
    Actually, I'll use the AUDSID and the LOGIN_TIME together to create a unique record.

    Thanks for your help...again.
    -Chuck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •