Sunday, May 1, 2011

AWR Report

The AWR collects and stores database statistics relating to problem detection and tuning. AWR is a replacement for the statspack utility which helps gather database performance statistics. AWR generates snapshots of key performance data, such as system and session statistics, segment-usage statistics, time-model statistics, high-load statistics and stores it in the sysaux tablespace.
AWR provides statistics in two formats
  • temporary - in memory collection of statistics in the SGA, accessible via the V$ views
  • persistent - type of performance data in the form of regular AWR snapshots which you access via the DBA_ views
The MMON process is responsible for collecting the statistics in the SGA and saving them to the sysaux tablespaces.
AWR will collect data on the following
  • Base statistics that are also part of the v$SYSSTAT and V$SESSTAT views
  • SQL statistics
  • Database object-usage statistics
  • Time-model statistics
  • Wait statistics
  • ASH (active session history) statistics
  • Operating system statistics
Tables that AWR uses to collect statistics
time model stats (db time, java execution time, pl/sql execution time, etc)
operating system stats (avg_busy_ticks, avg_idle_ticks, etc)
wait statistics ( db cpu, app wait time, user commits, etc)
system stats
session stats
Database performance stats fall into one of three categories:
  • Cumulative values - collect stats over a period of time from the v$sysstat, etc
  • Metrics - use the collected stats to make some sort of sense.
  • Sampled data - the ASH sampler is used to collect these stats.
AWR Setup
To active the AWR change the system parameter statistics_level to one of three values
  • basic - this option disables the AWR
  • typical (default) - activates standard level of collection
  • allsame as typical but includes execution plans and timing info from the O/S
alter system set statistics_level = typical;
alter system set statistics_level = all;
alter system set statistics_level = basic;
show parameter statistics_level;

To change the snapshot interval and how many days the snapshots are kept you use the package dbms_workload_repository or Enterprise Manager
Snapshot configuration
Change snapshotting values
exec dbms_workload_repository.modify_snapshot_settings ( interval => 60, retention => 43200);
interval = minutes
retention = seconds
Display values
select * from dba_hist_wr_control;
Snapshot Management
Create a snapshot
exec dbms_workload_repository.create_snapshot;
Delete snapshots
exec dbms_workload_repository.drop_snapshot_range (low_snap_id => 1077, high_snap_id => 1078);
Create a baseline
exec dbms_workload_repository.create_baseline (start_snap_id => 1070, end_snap_id => 1078, baseline_name => 'Normal Baseline');
Delete a baseline
exec dbms_workload_repository.drop_baseline (baseline_name => 'Normal Baseline', cascade => FALSE);
Display snapshots
select snap_id, begin_interval_time, end_interval_time from dba_hist_snapshot order by 1;
View the repository tables
select table_name from dba_tables where tablespace_name = ‘SYSAUX’ and substr(table_name, 1,2) = ‘WR’ and rownum <= 20 order by 1;
Useful Views
ASH info (see below)
baseline info
environment data
sql execution path data
AWR settings
snapshot info in the AWR

AWR Report
To run AWR report you can use the following operating system scripts or use Enterprise Manager.
the script will ask for begin snapshot and end snapshot and will be generated in text format
Note: reports went in $oracle_home\db_1\bin
the script will ask for begin snapshot and end snapshot and will be generated in HTML format
Note: reports went in $oracle_home\db_1\bin


Post a Comment

Auto Scroll Stop Scroll