3

Background:

We have a database environment where views are calling views which are calling views... the logic has become complex and now changes to underlying views can have significant impact on the top view being called by the client application.

Now while we are documenting all the logic and figuring out how to unwind everything development continues on and performance continues to degrade.

Currently I would manually run an explain plan on a client query and dig into tuning it. This is a slow and tedious process and changes may not be examined for ages.

Problem:

I want to generate a report that lists SQL ID and lists changes in actual time/discrepancy between estimated rows and actual rows/changes in buffers/changes in reads in comparison to the average computed over the last month.

I would generally run the following script manually and examine it based just on that day's response.

ALTER SESSION SET statistics_level=all;
set linesize 256;
set pagesize 0;
set serveroutput off;

-- QUERY

SELECT
    *
FROM
    table (DBMS_XPLAN.display_cursor (NULL, NULL, 'ALLSTATS LAST'));

What I am trying to do is see about automating the explain plan query and inserting the statistics into a table. From there I can run a regression report to detect changes in the performance which can then alert the developers.

I was thinking something like this would be common enough without having to resorting to the OEM. I can't find anything so I wonder if there is a more common approach to this?

4

3 回答 3

4

Oracle 通过自动工作负载信息库为此提供了功能。http://docs.oracle.com/cd/E11882_01/server.112/e16638/autostat.htm

不过,我相信这是企业版之上的额外许可。它应该可以在非生产环境中使用而无需额外费用,但请咨询您的 Oracle 销售代表。

于 2013-04-18T06:27:22.207 回答
2

听起来您正在重新发明 STATSPACK。Oracle 仍然将它包含在他们的数据库中,但不再记录它,大概是因为它是免费的,不像 AWR 和 ASH。您仍然可以在9i 手册中找到文档。

于 2013-04-18T09:21:32.617 回答
0

活动会话历史 (ASH) 是您正在寻找的

select * from v$active_session_history where sql_id = :yoursqlid 
于 2013-04-18T08:38:03.307 回答