How to list active / open connections in Oracle?

后端 未结 9 779
孤街浪徒
孤街浪徒 2020-11-30 17:25

Is there any hidden table, system variable or something to show active connections in a given moment?

相关标签:
9条回答
  • 2020-11-30 18:20

    When I'd like to view incoming connections from our application servers to the database I use the following command:

    SELECT username FROM v$session 
    WHERE username IS NOT NULL 
    ORDER BY username ASC;
    

    Simple, but effective.

    0 讨论(0)
  • 2020-11-30 18:22

    For a more complete answer see: http://dbaforums.org/oracle/index.php?showtopic=16834

    select
           substr(a.spid,1,9) pid,
           substr(b.sid,1,5) sid,
           substr(b.serial#,1,5) ser#,
           substr(b.machine,1,6) box,
           substr(b.username,1,10) username,
    --       b.server,
           substr(b.osuser,1,8) os_user,
           substr(b.program,1,30) program
    from v$session b, v$process a
    where
    b.paddr = a.addr
    and type='USER'
    order by spid; 
    
    0 讨论(0)
  • 2020-11-30 18:27
    select 
        count(1) "NO. Of DB Users", 
        to_char(sysdate,'DD-MON-YYYY:HH24:MI:SS') sys_time
    from 
        v$session 
    where 
        username is NOT  NULL;
    
    0 讨论(0)
提交回复
热议问题