How to list active / open connections in Oracle?

后端 未结 9 778
孤街浪徒
孤街浪徒 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:06
    Select count(1) From V$session
    where status='ACTIVE'
    /
    
    0 讨论(0)
  • 2020-11-30 18:08

    Use the V$SESSION view.

    V$SESSION displays session information for each current session.

    0 讨论(0)
  • 2020-11-30 18:10
    select s.sid as "Sid", s.serial# as "Serial#", nvl(s.username, ' ') as "Username", s.machine as "Machine", s.schemaname as "Schema name", s.logon_time as "Login time", s.program as "Program", s.osuser as "Os user", s.status as "Status", nvl(s.process, ' ') as "OS Process id"
    from v$session s
    where nvl(s.username, 'a') not like 'a' and status like 'ACTIVE'
    order by 1,2
    

    This query attempts to filter out all background processes.

    0 讨论(0)
  • 2020-11-30 18:11
    select status, count(1) as connectionCount from V$SESSION group by status;
    
    0 讨论(0)
  • 2020-11-30 18:19
    select
      username,
      osuser,
      terminal,
      utl_inaddr.get_host_address(terminal) IP_ADDRESS
    from
      v$session
    where
      username is not null
    order by
      username,
      osuser;
    
    0 讨论(0)
  • 2020-11-30 18:19

    The following gives you list of operating system users sorted by number of connections, which is useful when looking for excessive resource usage.

    select osuser, count(*) as active_conn_count 
    from v$session 
    group by osuser 
    order by active_conn_count desc
    
    0 讨论(0)
提交回复
热议问题