How to identify the SQL consuming more resources in Oracle?

OracleSoftware & CodingProgramming

Problem:

You want to identify the SQL statements consuming more resources in Oracle.

Solution

“V$SQLSTATS" view displays performance statistics for SQL statements that have recently executed. You can also use "V$SQL” and “V$SQLAREA" to report on SQL resource usage. 

"V$SQLSTATS” is faster and retains information for a longer period of time, but contains only a subset of the columns in “V$SQL" and "V$SQLAREA”.

Example

select * from( select   sql_text  ,buffer_gets  ,disk_reads  ,sorts  ,cpu_time/1000000 cpu_sec  ,executions  ,rows_processed from v$sqlstats order by cpu_time DESC) where rownum < 20;

raja
Published on 05-Dec-2020 10:54:28
Advertisements