P. 1
Awr Report

Awr Report

|Views: 184|Likes:
Published by Hemendra Singh

More info:

Published by: Hemendra Singh on May 02, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





he Oracle AWR report is the evolution of the STATSPACK report in Oracle 10g, and is invoked as follows


$ORACLE_HOME/rdbms/admin/awrrpt.sql $ORACLE_HOME/rdbms/admin/awrrpti.sql $ORACLE_HOME/rdbms/admin/awrinput.sql Creating an AWR Report The remaining procedures in the dbms_workload_repository package are awr_report_text andawr_report_html, which generate the AWR report for the specified snapshot range in text or HTML formats, respectively. The following script segment shows how to retrieve the AWR text report for any snapshot range or duration:
SELECT output FROM TABLE(dbms_workload_repository.awr_report_text (37933856,1,2900,2911 ));

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:  The database ID is 37933856.  The instance number for RAC is 1.  The starting snapshot number is 2900.  The ending snapshot number is 2911. This standard Oracle elapsed time report has evolved over the past 12 years and had several names:  report.txt: In Oracle7 and Oracle8, this BSTAT-ESTAT was taken by running the utlbstat.sqlfollowed by utlestat.sql in the $ORACLEHOME/rdbms/admin directory.  spreport: From Oracle8i to Oracle10g, this is an enhanced BSTAT-ESTAT report where the user chooses the beginning and ending snapshot numbers.

----------.95 3.11 0.--------- Begin Snap: 18 5.64 .96 0. and it is produced by running a SQL*Plus script in the $ORACLE_HOME/rdbms/admin directory.526.20 39.38 0.-------.78 (mins) 10.0 NO Snap Id Snap Time Sessions Curs/Sess --------. awrrpti.------------------.-----DBDABR Host1 37933856 dbdabr 1 10. AWR Report: In Oracle 10g.2 End Snap: 18 Elapsed: DB Time: 2900 19-Aug-04 11:00:29 2911 19-Aug-04 22:00:16 4. awrrpt.0.38 0.2.sql is a text-based report.6 659.-----------------.-----------.54 3.1.06 Per ----------18.21 11.30 116.08 (mins) Cache Sizes (end) ~~~~~~~~~~~~~~~~~ Buffer Cache: Shared Pool Size: 48M 56M Std Block Size: Log Buffer: 8K 256K Load Profile ~~~~~~~~~~~~ Transaction Redo size: Logical reads: Block changes: Physical reads: Physical writes: User calls: Per Second -------------1. OUTPUT ---------------------------------------------------------------WORKLOAD REPOSITORY report for DB Name DB Id Instance Inst Num Release Cluster Host -----------. this is the latest time-series report.sql is a HTML-based report for online publishing of time-series reports.31 411.766.

More details on reading the standard AWR report are included later in this book. In Oracle 10g statspack has evolved into the Automatic Workload Repository (AWR). Originally the UTLBSTAT/UTLESTAT scripts were used to monitor performance metrics.19 2.91 21.02 0.45 10. and it contains vital elapsed-time change information for what happened during the particular snapshot range. Automatic Workload Repository (AWR) in Oracle Database 10g Oracle have provided many performance gathering and reporting tools over the years.14 1.21 This is very similar to the old STATSPACK reports from Oracle9i. The next step is to learn about the dbms_advisor package and see how it can yield important Oracle tuning insights.04 0.37 1.02 43. • • • • • • AWR Features Snapshots Baselines Workload Repository Views Workload Repository Reports Enterprise Manager Related articles. • AWR Baseline Enhancements in Oracle Database 11g Release 1 AWR Features The AWR is used to collect performance statistics including: .Parses: Hard parses: Sorts: Logons: Executes: 4. Oracle8i introduced the Statspack functionality which Oracle9i extended.72 0.

Minutes.modify_snapshot_settings( retention => 43200. If you system has monthly archive and loads a 1 month retention time would be more beneficial that the default 7 days. Automatic collection is only possible if the STATISTICS_LEVEL parameter is set to TYPICAL or ALL. END. An interval of "0" switches off snapshot collection. -. Current value retained if NULL. hence this is not recommended. high_snap_id => 32). Object usage statistics. Some system and session statistics from the V$SYSSTAT and V$SESSTAT views. Current value retained if NULL. Time model statistics indicating the amount of DB time associated with a process from the V$SESS_TIME_MODEL and V$SYS_TIME_MODEL views. The default values for these settings can be altered using: BEGIN DBMS_WORKLOAD_REPOSITORY. . BEGIN DBMS_WORKLOAD_REPOSITORY. If the value is set to BASIC manual snapshots can be taken. interval => 30).create_snapshot. Active Session History (ASH) statistics from the V$ACTIVE_SESSION_HISTORY view. Resource intensive SQL statements. The repository is a source of information for several other Oracle 10g features including: • • • • Automatic Database Diagnostic Monitor SQL Tuning Advisor Undo Advisor Segment Advisor Snapshots By default snapshots of the relevant data are taken every hour and retained for 7 days. / The changes to the settings are reflected in the DBA_HIST_WR_CONTROL view. -. Typically the retention period should capture at least one complete workload cycle. which in turn stops much of the self-tuning functionality.• • • • • • Wait events used to identify performance problems. but they will be missing some statistics.drop_snapshot_range ( low_snap_id => 22. Extra snapshots can be taken and existing snapshots can be removed using: EXEC DBMS_WORKLOAD_REPOSITORY.Minutes (= 30 Days).

create_baseline ( start_snap_id => 210. -.Deletes associated snapshots if TRUE. V$METRIC . end_snap_id => 220. V$METRICGROUP .Displays historical metrics. You may wish to create baseline to represent a period of batch processing like: BEGIN DBMS_WORKLOAD_REPOSITORY. V$METRIC_HISTORY .Displays the active session history (ASH) sampled every second.Displays the history contents of the active session history.Displays database environment information.Displays baseline information.END.Displays the metrics associated with each metric group. Workload Repository Views The following workload repository views are available: • • • • • • • • V$ACTIVE_SESSION_HISTORY . baseline_name => 'batch baseline'). V$METRICNAME . END. DBA_HIST_ACTIVE_SESS_HISTORY .drop_baseline ( baseline_name => 'batch baseline'. / Snapshot information can be queried from the DBA_HIST_SNAPSHOT view. cascade => FALSE). DBA_HIST_DATABASE_INSTANCE .Displays all metrics groups. Once baselines are defined they can be used to compare current performance against similar periods in the past. Baselines A baseline is a pair of snapshots that represents a specific period of usage. . END. / Baseline information can be queried from the DBA_HIST_BASELINE view. DBA_HIST_BASELINE . / The pair of snapshots associated with a baseline are retained until the baseline is explicitly deleted: BEGIN DBMS_WORKLOAD_REPOSITORY.Displays metric information.

The "Automatic Workload Repository" page is accessed from the main page by clicking on the "Administration" link. Enterprise Manager The automated workload repository administration tasks have been included in Enterprise Manager.Displays AWR settings. DBA_HIST_SQL_PLAN .Displays snapshot information. They are similar in format to the statspack reports and give the option of HTML or plain text formats.sql @$ORACLE_HOME/rdbms/admin/awrrpti. DBA_HIST_WR_CONTROL . The two reports give essential the same output but the awrrpti.sql).• • • DBA_HIST_SNAPSHOT . The page allows you to modify AWR settings or manage snapshots without using the PL/SQL APIs. The reports can be generated as follows: @$ORACLE_HOME/rdbms/admin/awrrpt. the start snapshot id.sql The scripts prompt you to enter the report format (html or text).Displays SQL execution plans. the end snapshot id and the report filename. Form more information see: • • AWR Baseline Enhancements in Oracle Database 11g Release 1 Automatic Performance Statistics How to create AWR report manually 29102009 Oracle database 10g If you do not have Oracle Enterprise Manager tool installed then you can create the AWR reports manually using the following commands: .sql allows you to select a single instance.sql and awrrpti. then the "Workload Repository" link under the "Workload" section. The resulting report can be opend in a browser or text editor accordingly. Workload Repository Reports Oracle provide two scripts to produce workload repository reports (awrrpt.

topnsql => 100.MODIFY_SNAPSHOT_SETTINGS( retention => 43200. 4. you can load the extracted AWR data using the awrload.sql script extracts the AWR data for a range of snapshots from the database into a Data Pump export file.sql 5. this dump file can be transported to another system where the extracted data can be loaded. dbid => 7123356265). BEGIN DBMS_WORKLOAD_REPOSITORY . you need to be connected to the database as the SYS user. The data is then transferred from the staging schema into the appropriate AWR tables. Once created. / Snapshot (). To run the awrextr.1. The list of the snapshot Ids along with database Ids is availabe in the view DBA_HIST_SNAPSHOT. To extract AWR data at the SQL prompt. Extract the AWR Data The awrextr. high_snap_id => 122.sql script. The awrload. Load the AWR Data Once the export dump file is transported to the target system. Modifying Snapshot Settings If you want to modify the retention period as 43200 minutes (30 days). Dropping a Range of Snapshots. / The dbid is optional. END.sql script. the interval between each snapshot is specified as 30 minutes. Refer to the DBA_HIST_SNAPSHOT view column SNAP_ID to view available snapshots. interval => 30.CREATE_SNAPSHOT END. To run the awrload.sql script. dbid => 8187786345). you need to be connected to the database as the SYS user. To delete contain SNAP_ID from from 102 to 122. and the number of Top SQL to flush for each SQL criteria as 100 then use following: BEGIN DBMS_WORKLOAD_REPOSITORY .sql script will first create a staging schema where the snapshot data is transferred from the Data Pump file into the database. / 3. enter: SQL> @$ORACLE_HOME/rdbms/admin/awrextr. Creating BEGIN DBMS_WORKLOAD_REPOSITORY . END.DROP_SNAPSHOT_RANGE (low_snap_id => 102. . 2.

you are prompted for the beginning and ending snapshot Id for the workload repository report. you need to specify whether you want an HTML or a text report.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids. awrsqrpt. accept the default report name or enter a report name.sql The awrrpti. enter: SQL> @$ORACLE_HOME/rdbms/admin/awrload.To load AWR data at the SQL prompt. Generate AWR Reports The awrrpt.sql The awrrpt. The default name is accepted in the following example: Enter value Using the report name awrrpt_1_95_97 The workload repository report is generated.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids on a specified database and instance.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 for report_name: .sql The awrsqrpi. awrrpti.sql The awrsqrpt. Enter value for num_days: 2 After the list displays. To generate an HTML or text report for a range of snapshot Ids. Enter value Enter value for end_snap: 97 for begin_snap: 95 Next. Enter value for report_type: text Specify the number of days for which you want to list snapshot Ids. awrsqrpi.sql 6. Run this report to inspect or debug the performance of a SQL statement. run the awrrpt.sql script at the SQL prompt: SQL> @$ORACLE_HOME/rdbms/admin/awrrpt.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a range of snapshot Ids.sql First. awrrpt.

Run this report to inspect or debug the performance of a SQL statement on a specific database and instance.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration settings between two selected time periods.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. awrddrpi. awrddrpt.sql The awrddrpt.specified database and instance. Best Luck Possibly related posts: (automatically generated) • • • Creating a Database Snapshot Hello world! Generate AWR Report .

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->