时间:2021-07-01 10:21:17 帮助过:25人阅读
oracle占用cpu过高怎么处理,本文将介绍有关oracle进程CPU占用率过高的问题,需要了解跟多的朋友可以参考下
oracle占用cpu过高怎么处理,本文将介绍有关oracle进程CPU占用率过高的问题,需要了解跟多的朋友可以参考下
select sql_textITPUB
from v$sqltext
where a.hashvalue=(select sql_hash_value
from v$session b
where b.SID='&sid')
0order by piece ASC;
根据lockwait字段可以查询当前正在等待的锁的相关信息:
代码如下:
select * from v$lock where kaddr in (select lockwait from v$session where sid= $sid);
(sql_address,sql_hash_value),(prev_sql_addr,prev_hash_value) 根据这两组字段, 可以查询到当前session正在执行的或最近一次执行的sql语句的详细信息:
select * from v$sqltext where address = &sql_address and hash_value = &sql_hash_value;
根据PID查SQL相关信息:
代码如下:
select id,serial# ,username,osuser,machine,program,process,to_char(logon_time,'yyyy/mm/dd hh24:mi:ss') logon from v$session where paddr in ( select addr from v$process where spid in('&pid'));
根据PID查SQL语句
代码如下:
SELECT a.username,a.machine,a.program,a.sid,a.serial#,a.status,c.piece,c.sql_text FROM v$session a,v$process b,v$sqltext c WHERE b.spid='&spid' AND b.addr=a.paddr AND a.sql_address=c.address(+) ORDER BY c.piece;
得到进程的sid号:
代码如下:
select id,serial# ,username,osuser,machine,program,process,to_char(logon_time,'yyyy/mm/dd hh24:mi:ss') logon from v$session where paddr in ( select addr from v$process where spid in('&pid'));
得到session的sqltext语句:
代码如下:
select sql_text from v$sqltext_with_newlines where hash_value in (select SQL_HASH_VALUE from v$session where paddr in (select addr from v$process where spid= '&pid')) order by piece;