IT

Oracle에서 활성 / 열린 연결을 나열하는 방법은 무엇입니까?

lottoking 2020. 6. 9. 07:49
반응형

Oracle에서 활성 / 열린 연결을 나열하는 방법은 무엇입니까?


주어진 순간에 활성 연결을 보여줄 숨겨진 테이블, 시스템 변수 또는 무언가가 있습니까?


V$SESSION보기를 사용하십시오 .

V$SESSION 각 현재 세션에 대한 세션 정보를 표시합니다.


더 완전한 답변을 보려면 다음을 참조 하십시오 : 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; 

응용 프로그램 서버에서 데이터베이스로 들어오는 연결을 보려면 다음 명령을 사용하십시오.

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

간단하지만 효과적인.


select
  username,
  osuser,
  terminal,
  utl_inaddr.get_host_address(terminal) IP_ADDRESS
from
  v$session
where
  username is not null
order by
  username,
  osuser;

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

이 쿼리는 모든 백그라운드 프로세스를 필터링하려고합니다.


Select count(1) From V$session
where status='ACTIVE'
/

select status, count(1) as connectionCount from V$SESSION group by status;

다음은 연결 수별로 정렬 된 운영 체제 사용자 목록을 제공하므로 과도한 자원 사용을 찾을 때 유용합니다.

select osuser, count(*) as active_conn_count 
from v$session 
group by osuser 
order by active_conn_count desc

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;

참고 URL : https://stackoverflow.com/questions/1043096/how-to-list-active-open-connections-in-oracle

반응형