RE: Find out how often SQL is run
Date: Sat, 20 Feb 2010 10:33:45 -0600
Does AWR capture all statements?
If you don't change the TOPNSQL setting, then by default the value is 30, which I interpret to mean the top 30 statements per SQL order category in the AWR report. Does that mean AWR would capture the top 30 statements ordered descending for the following categories?: elapsed time, cpu time, gets, reads, parse calls, executions, version count, sharable memory, and cluster wait time. Would any statement that doesn't fall within those cateogries not be captured?
Just curious, as I've always been under the assumption that not all statements are captured. I tried to test this out but still found a few statements that didn't fit within the top 30 per the above categories (for snapshots with the largest amount of SQL statements captured). Maybe I've got the wrong columns from DBA_HIST_SQLSTAT that I'm using.
Anyone know more details about this?
Dave Herring | DBA, Global Technology Services
A c x i o m C o r p o r a t i o n
630-944-4762 office | 630-430-5988 cell | 630-944-4989 fax 1501 Opus Pl | Downers Grove, IL, 60515 | U.S.A. | www.acxiom.com Service Desk: 888-243-4566, https://servicedesk.acxiom.com, GSCA_at_DNB.com
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of D'Hooge Freek Sent: Thursday, February 18, 2010 3:18 AM To: GiantPanda_at_gmx.net; Oracle-l_at_freelists.org Subject: RE: Find out how often SQL is run
You can find this information in the awr tables. The execution times and such will be averages for the executions between the 2 snapshots.
set linesize 120
set pages 999
column avg_elapsed_sec format 99999D99
column disk_reads format 999999999
column buffer_gets format 999999999
select to_char(snap.begin_interval_time, 'DD/MM/YYYY HH24:MI:SS') btime,
to_char(snap.end_interval_time, 'DD/MM/YYYY HH24:MI:SS') etime, snap.snap_id, snap.instance_number, sqlstat.executions_delta nbr_executions, (sqlstat.elapsed_time_delta / sqlstat.executions_delta/1000000) avg_elapsed_sec, (sqlstat.disk_reads_delta / sqlstat.executions_delta) disk_reads, (sqlstat.buffer_gets_delta / sqlstat.executions_delta) buffer_getsfrom dba_hist_snapshot snap, dba_hist_sqlstat sqlstat where snap.snap_id = sqlstat.snap_id(+)
and snap.instance_number = sqlstat.instance_number(+) and sql_id = '&sql_id'
order by snap.snap_id, snap.instance_number;
Note that you are only allowed to access the awr tables when you have licensed the diagnostic pack. Which is not available for Standard Edition, although the tables are there and awr snapshots are enabled by default (and no, I don't know what the guys at Oracle where smoking when they came up with this rule).
Oracle Database Administrator
tel +32(0)3 451 23 82
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Ingrid Voigt Sent: woensdag 17 februari 2010 21:02
Subject: Find out how often SQL is run
I need to find out how often a particular query (identified by SQL id) is run. If possible also how long executions take and if the execution plan varies. Database version is 10.2.0.4 Standard Edition on Windows.
Do I have to schedule a job to query v$sqlarea regularly? Or is there something better (Statspack?)
Thanks for your help.
The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged.
If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please resend this communication to the sender and delete the original message or any copy of it from your computer system.
http://www.freelists.org/webpage/oracle-l Received on Sat Feb 20 2010 - 10:33:45 CST