Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

AWR report provide the SQL information for top 10-20 SQLs, is it possible to get information on SQLs that do not make it to the top list. How do we find all sql id, sql text, number of executions,execution time between two AWR snap ids in oracle.

share|improve this question

migrated from stackoverflow.com Feb 12 '14 at 8:04

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 0 down vote accepted

This will get those fields between 2 snap IDs, just replace the snap ID's in the where clause

select t.sql_id,
    t.sql_text,
    s.executions_total,
    s.elapsed_time_total
from DBA_HIST_SQLSTAT s, DBA_HIST_SQLTEXT t
where s.snap_id between 1000 and 2000;
share|improve this answer
    
You should at least apply some join between the tables –  a_horse_with_no_name Feb 12 '14 at 22:57
    
Oracle will just lazy equijoin the two tables, no reason to specify another type based on the question. If you had a reason to need to maintain the snippet with DBA's or developers who are more familiar with another type of db, then specifying inner join might be useful. –  Threaten Feb 12 '14 at 23:01
    
Thanks for the help –  Deven Feb 13 '14 at 6:45

You can select from the below views.

Historical SQL statistics: DBA_HIST_SQLSTAT All SQL text: DBA_HIST_SQLTEXT Map snap_id to actual time: DBA_HIST_SNAPSHOT

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.