'DB'에 해당되는 글 11건

  1. 2014.02.03 Oracle SID, SPID 를 통해 수행하고 있는 쿼리 찾기
2014. 2. 3. 14:43

## oracle sid를 이용한 sql문 찾기


set pages 40
col program for a25
col username for a10
col machine for a15
col module for a25
col spid for a6
col sid for 99999
select a.username,a.program,a.machine,a.module,b.spid,a.sid,a.serial#,a.status,
       c.sql_text
  from v$session a,
       v$process b,
       v$sql     c
 where a.sid = '&sid'
   and b.addr = a.paddr
   and a.sql_hash_value = c.hash_value(+)
   and a.sql_address    = c.address(+);

 

## os pid를 이용한 sql문 찾기

 

set pages 40
col module for a10
col MACHINE for a10
 select /-+ use_hash(a,b,c) *-
       a.username,a.program,a.machine,a.module,b.spid,a.sid,a.serial#,a.sql_hash_value,
       d.PHYSICAL_READS, d.BLOCK_GETS,
       c.sql_text
  from v$session a,
       v$process b,
       v$sql     c,
       v$sess_io d
 where b.spid = '&pid'
   and b.addr = a.paddr
   and a.sid  = d.sid
   and a.sql_hash_value = c.hash_value(+)
   and a.sql_address    = c.address(+);

Posted by silver0r