当前位置: 代码迷 >> SQL >> 怎么找到占用CPU极高的线程执行的SQL语句
  详细解决方案

怎么找到占用CPU极高的线程执行的SQL语句

热度:32   发布时间:2016-05-05 14:03:28.0
如何找到占用CPU极高的线程执行的SQL语句
其实只是一条语句,步步递进

Select addr from v$process c where c.spid='30154';

Select decode(sql_hash_value, 0, prev_hash_value, sql_hash_value),
       Decode(sql_hash_value, 0, prev_sql_addr, sql_address)
  From v$session b
where (b.paddr = (Select addr from v$process c where c.spid = '30154'));

select sql_text from v$sqltext a where (a.hash_value,a.address) IN
(Select decode(sql_hash_value,0,prev_hash_value,sql_hash_value),
Decode(sql_hash_value,0,prev_sql_addr,sql_address)
From v$session b where (b.paddr = (Select addr from v$process c where c.spid='30154')));
  相关解决方案