Posted By

mifly on 03/25/10


Tagged

Oracle


Versions (?)

找到耗CPU比较高的语句


 / Published in: PL/SQL
 

  1. FROM (SELECT HASH_VALUE,
  2. SQL_TEXT,
  3. b.MACHINE,
  4. SUM(A.EXECUTIONS) EXECUTIONS,
  5. SUM(A.PARSE_CALLS) PARSE_CALLS,
  6. SUM(A.CPU_TIME) CPU_TIME,
  7. SUM(A.DISK_READS) DISK_READS,
  8. SUM(A.DISK_READS) / SUM(A.EXECUTIONS) DISK_EXEC,
  9. SUM(A.CPU_TIME) / SUM(A.EXECUTIONS) CPU_EXEC
  10. FROM V$SQLAREA A, v$session b
  11. WHERE A.EXECUTIONS <> 0
  12. AND SQL_TEXT NOT LIKE 'DECLARE%'
  13. AND a.HASH_VALUE = b.SQL_HASH_VALUE
  14. AND b.STATUS = 'ACTIVE'
  15. GROUP BY HASH_VALUE, SQL_TEXT,MACHINE
  16. ORDER BY CPU_EXEC DESC)
  17. WHERE EXECUTIONS > 1
  18. AND CPU_EXEC>500000;

Report this snippet  

You need to login to post a comment.