oracle 查询当前占用cpu及时间最长的sql语句

SELECT

A.USERNAME, A.COMMAND, A.STATUS,

A.PROGRAM, A.MACHINE, A.CLIENT_IDENTIFIER,

B.SQL_TEXT,

B.CPU_TIME,

B.SHARABLE_MEM,

ROUND((B.DISK_READS + B.BUFFER_GETS)/B.EXECUTIONS)

AS RESOURCE_COST

FROM

V$SESSION A,

V$SQLSTATS B

WHERE

A.SQL_ID = B.SQL_ID

AND B.EXECUTIONS >0

AND A.WAIT_CLASS <> 'Idle'

ORDER BY

RESOURCE_COST DESC;

你可能感兴趣的:(oracle 查询当前占用cpu及时间最长的sql语句)