DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: my seesion id, username etc

  1. #1
    Join Date
    Feb 2001
    Posts
    125

    my seesion id, username etc

    hi all


    i am using win2k/oracle 8i

    when i connect to oracle i want to know my sessionid etc.
    i don't want to use
    terminal=?
    osuser = ? etc.




    by

  2. #2
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Code:
    select userenv('sessionid') from dual;
    or
    Code:
    select sys_context('userenv','sessionid') from dual;
    Last edited by SANJAY_G; 07-18-2003 at 02:42 AM.
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  3. #3
    Join Date
    Dec 2001
    Location
    SAN FRANCISCO, CA
    Posts
    306
    there is a table called v$session

    u can give like this

    select sid,serial#,username,machine,terminal from v$session where username='Ur username';

    u will get ur session id details.
    Eat , Drink & Enjoy life -

    pravin_kini@hotmail.com

  4. #4
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Originally posted by pravin
    there is a table called v$session

    u can give like this

    select sid,serial#,username,machine,terminal from v$session where username='Ur username';

    u will get ur session id details.
    What if there are multiple sessions for same username??
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  5. #5
    Join Date
    Dec 2000
    Location
    Mumbai
    Posts
    38
    if multiple sessions are connected from same username then the sid and serial# various.

  6. #6
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758
    Originally posted by shashikumar
    if multiple sessions are connected from same username then the sid and serial# various.
    True. But read the original question again.
    Sanjay G.
    Oracle Certified Professional 8i, 9i.

    "The degree of normality in a database is inversely proportional to that of its DBA"

  7. #7
    Join Date
    Jun 2000
    Posts
    295
    If you only need sid, I use:
    select sid from V$mystat where rownum =1;

  8. #8
    Join Date
    Feb 2003
    Posts
    85
    Originally posted by sysdba
    If you only need sid, I use:
    select sid from V$mystat where rownum =1;
    that if you have the privilege which by default you dont

Posting Permissions

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


Click Here to Expand Forum to Full Width