Skip to Main Content
  • Questions
  • Please give the sql to get query performance in oracle database, i don't want to use statspack.

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Mukesh.

Asked: July 29, 2016 - 9:34 am UTC

Last updated: August 01, 2016 - 1:33 pm UTC

Version: Oracle 12c

Viewed 1000+ times

You Asked

I was SQL Server DBA over 1 year, now i am oracle DBA so i used to use below query against sql server database to get query performance.

SELECT TOP 5
    ObjectName          = OBJECT_SCHEMA_NAME(qt.objectid,dbid) + '.' + OBJECT_NAME(qt.objectid, qt.dbid)
    ,TextData           = qt.text
    ,DiskReads          = qs.total_physical_reads   -- The worst reads, disk reads
    ,MemoryReads        = qs.total_logical_reads    --Logical Reads are memory reads
    ,Executions         = qs.execution_count
    ,TotalCPUTime       = qs.total_worker_time
    ,AverageCPUTime     = qs.total_worker_time/qs.execution_count
    ,DiskWaitAndCPUTime = qs.total_elapsed_time
    ,MemoryWrites       = qs.max_logical_writes
    ,DateCached         = qs.creation_time
    ,DatabaseName       = DB_Name(qt.dbid)
    ,SQLHandle          = CONVERT(VARCHAR(1000), qs.sql_handle, 2)
    ,LastExecutionTime  = qs.last_execution_time
 FROM sys.dm_exec_query_stats AS qs
 CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt
 ORDER BY DiskReads DESC



Can i get the query in oracle something like above?


and Connor said...

If you are licensed for ASH and AWR, then thats the best resource. If not, check out ASH Masters

http://datavirtualizer.com/ash-masters/

and ASHMON and S-ASH.

It's a suite of facilities to give you a holistic view of performance.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, August 01, 2016 - 10:35 am UTC

If organization use oracle 11g Standard Edition version then which report is available in terms of like ASH, AWR, ....\
For checking database health and diagnostics.
Chris Saxon
August 01, 2016 - 1:33 pm UTC

See my response below. You need to have the Diagnostics pack to use AWR & ASH. This requires EE.

Chris

Standard edition

Rajeshwaran, Jeyabal, August 01, 2016 - 12:48 pm UTC

AWR / ASH is still available for 11g Standard edition.

http://docs.oracle.com/cd/E11882_01/license.112/e47877/editions.htm#DBLIC116
Chris Saxon
August 01, 2016 - 1:32 pm UTC

No. You need to be licensed for the Diagnostics Pack to use ASH / AWR:

http://docs.oracle.com/cd/E11882_01/license.112/e47877/options.htm#DBLIC165

This is extra cost on top of EE and not available for SE / SE1 according to the link you've provided.

Chris

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.