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;