Professional Documents
Culture Documents
invoked as follows:
$ORACLE_HOME/rdbms/admin/awrrpt.sql
$ORACLE_HOME/rdbms/admin/awrrpti.sql
$ORACLE_HOME/rdbms/admin/awrinput.sql
The sample output below shows the typical report generated for AWR data.
The output displays shows the four arguments to the awr_report_text stored
procedure:
This standard Oracle elapsed time report has evolved over the past 12 years and
had several names:
OUTPUT
-----------------------------------------------------
------------
WORKLOAD REPOSITORY report for
Load Profile
~~~~~~~~~~~~ Per Second Per
Transaction
-------------- -----------
Redo size: 1,766.20 18,526.31
Logical reads: 39.21 411.30
Block changes: 11.11 116.54
Physical reads: 0.38 3.95
Physical writes: 0.38 3.96
User calls: 0.06 0.64
Parses: 2.04 21.37
Hard parses: 0.14 1.45
Sorts: 1.02 10.72
Logons: 0.02 0.21
This is very similar to the old STATSPACK reports from Oracle9i, and it
contains vital elapsed-time change information for what happened during the
particular snapshot range.
More details on reading the standard AWR report are included later in this
book.
The next step is to learn about the dbms_advisor package and see how it can
yield important Oracle tuning insights.
• AWR Features
• Snapshots
• Baselines
• Workload Repository Views
• Workload Repository Reports
• Enterprise Manager
Related articles.
AWR Features
The repository is a source of information for several other Oracle 10g features
including:
Snapshots
By default snapshots of the relevant data are taken every hour and retained for 7
days. The default values for these settings can be altered using:
BEGIN
DBMS_WORKLOAD_REPOSITORY.modify_snapshot_settings(
retention => 43200, -- Minutes (= 30 Days). Current value
retained if NULL.
interval => 30); -- Minutes. Current value retained if
NULL.
END;
/
Extra snapshots can be taken and existing snapshots can be removed using:
EXEC DBMS_WORKLOAD_REPOSITORY.create_snapshot;
BEGIN
DBMS_WORKLOAD_REPOSITORY.drop_snapshot_range (
low_snap_id => 22,
high_snap_id => 32);
END;
/
Baselines
The pair of snapshots associated with a baseline are retained until the baseline is
explicitly deleted:
BEGIN
DBMS_WORKLOAD_REPOSITORY.drop_baseline (
baseline_name => 'batch baseline',
cascade => FALSE); -- Deletes associated snapshots if TRUE.
END;
/
Oracle provide two scripts to produce workload repository reports (awrrpt.sql and
awrrpti.sql). They are similar in format to the statspack reports and give the
option of HTML or plain text formats. The two reports give essential the same
output but the awrrpti.sql allows you to select a single instance. The reports can
be generated as follows:
@$ORACLE_HOME/rdbms/admin/awrrpt.sql
@$ORACLE_HOME/rdbms/admin/awrrpti.sql
The scripts prompt you to enter the report format (html or text), the start snapshot
id, the end snapshot id and the report filename. The resulting report can be
opend in a browser or text editor accordingly.
Enterprise Manager
If you do not have Oracle Enterprise Manager tool installed then you can
create the AWR reports manually using the following commands:
1. Creating Snapshot
BEGIN
DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
END;
/
The list of the snapshot Ids along with database Ids is availabe in the
view DBA_HIST_SNAPSHOT.
BEGIN
DBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE (low_snap_id =>
102, high_snap_id => 122, dbid => 8187786345);
END;
/
BEGIN
DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( retention =>
43200,
interval => 30, topnsql => 100, dbid => 7123356265);
END;
/
The dbid is optional.
SQL> @$ORACLE_HOME/rdbms/admin/awrextr.sql
SQL> @$ORACLE_HOME/rdbms/admin/awrload.sql
SQL> @$ORACLE_HOME/rdbms/admin/awrrpt.sql
First, you need to specify whether you want an HTML or a text report.
Specify the number of days for which you want to list snapshot Ids.
After the list displays, you are prompted for the beginning and ending
snapshot Id for the workload repository report.
Next, accept the default report name or enter a report name. The default
name is accepted in the following example:
awrrpt.sql
The awrrpt.sql SQL script generates an HTML or text report that displays
statistics for a range of snapshot Ids.
awrrpti.sql
The awrrpti.sql SQL script generates an HTML or text report that displays
statistics for a range of snapshot Ids on a specified database and instance.
awrsqrpt.sql
The awrsqrpt.sql SQL script generates an HTML or text report that displays
statistics of a particular SQL statement for a range of snapshot Ids. Run this
report to inspect or debug the performance of a SQL statement.
awrsqrpi.sql
The awrsqrpi.sql SQL script generates an HTML or text report that displays
statistics of a particular SQL statement for a range of snapshot Ids on a
specified database and instance. Run this report to inspect or debug the
performance of a SQL statement on a specific database and instance.
awrddrpt.sql
The awrddrpt.sql SQL script generates an HTML or text report that compares
detailed performance attributes and configuration settings between two
selected time periods.
awrddrpi.sql
The awrddrpi.sql SQL script generates an HTML or text report that compares
detailed performance attributes and configuration settings between two
selected time periods on a specific database and instance.
Best Luck