Wednesday, December 11, 2013

trcsess Tips

When solving tuning problems, session traces are very useful and offer vital information.  Traces are simple and straightforward for dedicated server sessions, but for shared server sessions, many processes are involved. The trace pertaining to the user session is scattered across different trace files belonging to different processes. This makes it difficult to get a complete picture of the life cycle of a session.

Now there is a new tool, a command line utility called trcsess to help read the trace files. The trcsess command-line utility consolidates trace information from selected trace files, based on specified criteria. The criteria include session id, client id, service name, action name and module name.

The trcsess command-line utility offers the DBA a way to combine or consolidate several trace files into a single trace file based upon the following criteria:
  • Session Id
  • Client Id
  • Service name
  • Action name
  • Module name
When using dedicated server processes, monitoring only a single session and not doing parallel operations, there is little need for the trcsess utility. But when using shared server processes, monitoring several sessions concurrently, and/or doing parallel DML, the workload can span multiple trace files. In fact, it can be located on different nodes in a RAC environment if the parallel operations cross nodes.

Also note that beginning with Oracle 10g, Oracle Trace functionality is no longer available. For tracing database activity, use SQLTrace or TKPROF instead.
The syntax for the trcsess utility is:
trcsess [output=output_file_name] 
[session=session_Id] 
[clientid=client_Id] 
[service=service_name] 
[action=action_name] 
[module=module_name] 
[trace_files]

where:
  • output specifies the file where the output is generated. When this option is not specified, the standard output is used for the output.
  • session consolidates the trace information for the session specified. The session Id is a combination of session index and session serial number.
  • clientid consolidates the trace information given client Id.
  • service consolidates the trace information for the given service name.
  • action consolidates the trace information for the given action name.
  • module consolidates the trace information for the given module name.
  • trace_files is a list of all trace file names, separated by spaces, in which trcsess will look for trace information. The wild card character * can be used to specify the trace file names. If trace files are not specified, all the files in the current directory are checked by trcsess.
Once the trace files have been consolidated, tkprof can be run against the consolidated trace file for reporting purposes.

Utilities for Analyzing Oracle Trace Files
There are several utilities for analyzing Oracle trace files. These include trace assist (trcasst), session tracer (trcsess), trace analyzer (trcanlzr.sql) and tkprof. Many DBAs are very familiar with the Oracle trace facility, but just in case, here are some brief instructions for using this powerful Oracle utility. Before tracing can be enabled, the environment must first be configured by performing the following steps:
  1. Enable Timed Statistics: This parameter enables the collection of certain vital statistics such as CPU execution time, wait events, and elapsed times. The resulting trace output is more meaningful with these statistics. The command to enable timed statistics is: 
    ALTER SYSTEM SET TIMED_STATISTICS = TRUE;
  2. Check the User Dump Destination Directory: The trace files generated by Oracle can be numerous and large. These files are placed by Oracle in the user_dump_dest directory as specified in the init.ora. The user dump destination can also be specified for a single session using the alter session command. Make sure that enough space exists on the device to support the number of trace files that you expect to generate.
  3. Turn Tracing On: The next step in the process is to enable tracing. By default, tracing is disabled due to the burden (5-10%) it places on the database. Tracing can be defined at the session level:
ALTER SESSION SET SQL_TRACE = TRUE; 
DBMS_SESSION.SET_SQL_TRACE(TRUE);
A DBA may enable tracing for another user’s session by using the following statement:
DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION (sid,serial#,true);
The sid (Session ID) and serial# can be obtained from the v$session view. Once tracing with Oracle tkprof is enabled, Oracle generates and stores the statistics in the trace file. The trace file name is version specific.
  1. Enable Oracle tkprof tracing only on those sessions that are having problems. Explain Plan is not as useful when used in conjunction with tkprof since the trace file contains the actual execution path of the SQL statement. Use Explain Plan when anticipated execution statistics are desired without actually executing the statement.
  2. When tracing a session, remember that nothing in v$session indicates that a session is being traced. Therefore, trace with caution and remember to disable tracing after an adequate amount of trace data has been generated.
Tkprof does not control the contents of a trace file, it simply formats them. Oracle provides multiple ways to actually generate the trace file. Tkprof is valuable for detailed trace file analysis. For those DBAs that prefer a simpler tracing mechanism with instant feedback, the autotrace utility should be used.
The trace assist (trcasst) utility is used to analyze Oracle trace files generated by most Oracle error messages. This utility will analyze the trace file and put it into a readable format.

Monday, December 9, 2013

Active Session History: Overview

ASH represents the history of recent sessions activity. The diagram shows you how sessions are sampled when active. Each second, the Oracle database server looks at active sessions, and records the events these sessions are waiting for. Inactive sessions are not sampled. The sampling facility is very efficient because it directly accesses the Oracle database internal structures. The following is the sampled information:

  • SQL identifier of SQL statement 
  • Object number, file number, and block number 
  • Wait event identifier and parameters 
  • Session identifier and session serial number 
  • Module and action name 
  • Client identifier of the session 
  • Service hash identifier
ASH statistics are available through the V$ACTIVE_SESSION_HISTORY fixed view. This view contains one row for each active session per sample. All columns that describe the session in the ASH are present in the V$SESSION view.


The V$ACTIVE_SESSION_HISTORY view provides sampled session activity in the instance. This can be used as a first fault system analysis. Any session that is connected to the database and is waiting for an event that does not belong to the Idle wait class is considered as an active session. This includes any session that was on the CPU at the time of sampling. 


Active session samples are stored in a circular buffer in SGA. As the system activity increases, the number of seconds of session activity that can be stored in the circular buffer decreases. The time of a session sample is retained in the V$ view. The number of seconds of session activity displayed in the V$ view is completely dependent on database activity.

The memory for the ASH comes from the System Global Area (SGA), and it is fixed for the lifetime of the instance. It represents 2 MB of memory per CPU. The ASH cannot exceed a maximum bound of five percent of the shared pool size, or five percent of the SGA_TARGET.


When Automatic Workload Repository (AWR) snapshots are created, the content of V$ACTIVE_SESSION_HISTORY is flushed to disk. 

By capturing only active sessions, a manageable set of data is represented and its size is directly related to the work being performed rather than the number of sessions allowed on the system. You can examine the current Active Session History (ASH) data in the V$ACTIVE_SESSION_HISTORY view and historical data in the DBA_HIST_ACTIVE_SESS_HISTORY view. 


You can also perform detailed analysis on this data, often avoiding the need to replay the workload to gather additional performance tracing information. The data present in the ASH can be rolled up on the various dimensions that it captures.

DBTime-Graph and ADDM Methodology





Identifying the component contributing the most database time is equivalent to finding the single database component that provides the greatest benefit when tuned. ADDM uses database time to identify database components that require investigation and also to quantify performance bottlenecks. 


The first step in automatic performance tuning is to correctly identify the causes of performance problems. Only when the root cause of the performance problem is correctly identified, is it possible to explore effective tuning recommendations to solve or alleviate the issue.


ADDM looks at the database time spent in two independent dimensions:

  • The first dimension looks at the database time spent in various phases of processing user requests. This dimension includes categories such as “connecting to the database,” “optimizing SQL statements,” and “executing SQL statements.”


  • The second dimension looks at the database time spent using or waiting for various database resources used in processing user requests. The database resources considered in this dimension include both hardware resources, such as CPU and I/O devices, and software resources, such as database locks and application locks.
To perform automatic diagnosis, ADDM looks at the database time spent in each category under both these dimensions and drills down to the categories that had consumed significant database time. This two-dimensional drilldown process can be represented using the DBTime-graph.

Performance problems often distribute database time across many categories in one dimension but not in the other. For example, a database with insufficient CPU capacity slows down all phases involved in processing user requests, which is in the first dimension of the ADDM analysis. 

However, it would be evident from the second dimension that the top performance problem affecting the database is insufficient CPU capacity. This two-dimensional view of determining where the database time is consumed gives ADDM very good judgment in zooming in to the more significant performance issues.

ADDM and Database Time



Database time is defined as the sum of the time spent inside the database processing user requests. 

The user’s response time is the time interval between the instant the request is sent and the instant the response is received. The database time involved in that user request is only a portion of that user’s response time that is spent inside the database.

The upper graphic in the slide above illustrates a simple scenario of a single user submitting a request. The user’s response time is the time interval between the instant the request is sent and the instant the response is received. The database time involved in that user request is only a portion of that user’s response time that is spent inside the database. 
 
The lower graphic in the slide illustrates database time as it is summed over multiple users, and each user is performing a series of operations resulting in a series of requests to the database. You can see that the database time is directly proportional to the number and duration of user requests, and can be higher or lower than the corresponding wall-clock time (elapsed time).

Using the database time as a measure, you can gauge the performance impact of any entity of the database. 

For example, the performance impact of an undersized buffer cache would be measured as the total database time spent in performing additional I/O requests that could have been avoided if the buffer cache were larger.

Database time is simply a measurement of the total amount of work done by the database server. The rate at which the database time is consumed is the database load average, measured as database time per second. 

The objective of ADDM is to reduce the amount of database time spent on a given workload, which is analogous to consuming less energy to perform the same task.

ADDM Performance Monitoring


ADDM is scheduled to run automatically by the MMON process on every database instance to detect problems proactively. Each time a snapshot is taken, ADDM is triggered to perform an analysis of the period corresponding to the last two snapshots. This approach proactively monitors the instance and detects bottlenecks before they become a significant problem.


The results of each ADDM analysis are stored in Automatic Workload Repository and are also accessible through Database Control.

By default, the Oracle database server automatically captures statistical information from the SGA every 60 minutes and stores it in Automatic Workload Repository (AWR) in the form of snapshots. These snapshots are stored on disk and are similar to Statspack snapshots. However, they contain more precise information than the Statspack snapshots.


Additionally, ADDM is scheduled to run automatically by the MMON process on every database instance to detect problems proactively. Each time a snapshot is taken, ADDM is triggered to perform an analysis of the period corresponding to the last two snapshots. This approach proactively monitors the instance and detects bottlenecks before they become a significant problem.


The results of each ADDM analysis are stored in Automatic Workload Repository and are also accessible through Database Control.


Note: Although ADDM analyzes Oracle database performance over the period defined by the last two snapshots, it is possible to manually invoke an ADDM analysis across any two snapshots.


Types of Problems Analyzed by ADDM:
  • CPU load 
  • Memory usage 
  • I/O usage 
  • Resource intensive SQL 
  • Resource intensive PL/SQL and Java 
  • RAC issues 
  • Application issues 
  • Database configuration issues 
  • Concurrency issues 
  • Object contention 

ADDM is enabled by default and controlled by two parameters

  1. CONTROL_MANAGEMENT_PACK_ACCESS, if set to DIAGNOSTIC or DIAGNOSTIC+TUNNING 
  2. STATISTICS_LEVEL if set to either TYPICAL or ALL 
ADDM can be executed in three modes
  1. Database Mode
  2. Instance Mode
  3. Partial Mode
Below example creates an ADDM task in database analysis mode for the entire database during the time period defined by snapshots 11050 and 11056


VAR tname VARCHAR2(30);
BEGIN
  :tname := 'ADDM for 11PM to 5AM';
  DBMS_ADDM.ANALYZE_DB(:tname,  11050, 11056);
END;



Snap ids can be taken from below SQL

SQL> select * from DBA_HIST_SNAPSHOT
To analyze a particular instance of the database
VAR tname VARCHAR2(30);
BEGIN
  :tname := 'my ADDM for 11PM to 5AM';
  DBMS_ADDM.ANALYZE_INST(:tname,11050,11056, 1);
END;

Where 1 = Instance number

Running the ADDM in Partial Mode:
VAR tname VARCHAR2(30); BEGIN   :tname := 'my ADDM for 7PM to 9PM';   DBMS_ADDM.ANALYZE_PARTIAL(:tname, '1,2,4', 11050, 11056); END; Where 1, 2, and 4 are the instance numbers during the time period defined by snapshots 11050 and 11056 snapshots

Running the ADDM Reports:
SQL> SELECT DBMS_ADDM.GET_REPORT( :tname) FROM DUAL;


-- UNIX
@/u01/app/oracle/product/10.1.0/db_1/rdbms/admin/addmrpt.sql

DBMS_ADVISOR

The DBMS_ADVISOR package can be used to create and execute any advisor tasks, including ADDM tasks. The following example shows how it is used to create, execute and display a typical ADDM report.
BEGIN
  -- Create an ADDM task.
  DBMS_ADVISOR.create_task (
    advisor_name      => 'ADDM',
    task_name         => '970_1032_AWR_SNAPSHOT',
    task_desc         => 'Advisor for snapshots 970 to 1032.');

  -- Set the start and end snapshots.
  DBMS_ADVISOR.set_task_parameter (
    task_name => '970_1032_AWR_SNAPSHOT',
    parameter => 'START_SNAPSHOT',
    value     => 970);

  DBMS_ADVISOR.set_task_parameter (
    task_name => '970_1032_AWR_SNAPSHOT',
    parameter => 'END_SNAPSHOT',
    value     => 1032);

  -- Execute the task.
  DBMS_ADVISOR.execute_task(task_name => '970_1032_AWR_SNAPSHOT');
END;
/

-- Display the report.
SET LONG 100000
SET PAGESIZE 50000
SELECT DBMS_ADVISOR.get_task_report('970_1032_AWR_SNAPSHOT') AS report
FROM   dual;
SET PAGESIZE 24







Defining Alert Thresholds Using a Static Baseline


After AWR baseline statistics are computed for a particular baseline, you can set metric thresholds specific to your baseline.

Compute baseline statistics directly from the Baselines page (as previously discussed). Then go to the AWR Baseline Metric Thresholds page and select the type of metrics that you want to set. When done, select a specific metric and click Edit Thresholds.

On the corresponding Edit AWR Baseline Metric Thresholds page, specify your thresholds in the Thresholds Settings section, and then click Apply Thresholds.
You can specify thresholds based on the statistics computed for your baseline. This is illustrated in the slide. In addition to “Significance Level,” the other possibilities are “Percentage of Maximum” and “Fixed Values.”

Note: After a threshold is set using Baseline Metric Thresholds, the previous threshold values are forgotten forever and the statistics from the associated baseline are used to determine the threshold values until they are cleared (by using the Baseline Metric Threshold UI or PL/SQL interface).


Performance Monitoring and Baselines


When they are properly set, alert thresholds provide a valuable service—an alert—by indicating a performance metric that is at an unexpected value. Unfortunately, in many cases the expected value varies with the workload type, system load, time of day, or day of the week. Baselines associated with certain workload types or days of the week capture the metric values of that period. The baseline can then be used to set the threshold values when similar conditions exist.

The statistics for baselines are computed to place a minimal load on the system; statistics for static baselines are manually computed. You can schedule statistics computation on the AWR Baselines page. Statistics for the system moving window are automatically computed according to the BSLN_MAINTAIN_STATS_SCHED schedule. By default, this schedule starts the job every week at noon on Saturday.

Performance Monitoring and Baselines
Metric statistics computed over a baseline enable you to set thresholds that compare the baseline statistics to the current activity. There are three methods of comparison:

  • significance level
  • percentage of maximum and 
  • fixed values
Thresholds based on significance level use statistical relevance to determine which current values are unusual. In simple terms, if the significance level is set to .99 for a critical threshold, the threshold is set where 1% of the baseline values fall outside this value and any current values that exceed this value trigger an alert. A higher significance level of .999 or .9999 causes fewer alerts to be triggered.

Thresholds based on percentage of maximum are calculated based on the maximum value captured by the baseline.

Threshold values based on fixed values are set by the DBA. No baseline is required.




Creating AWR Baselines


You can create two types of AWR baselines: single and repeating. The Create Baseline: Baseline Interval Type page gives the following explanations.

The single type of baseline has a single and fixed time interval: for example, from Jan 1, 2007, at 10:00 AM, to Jan 1, 2007, at 12:00 PM. The repeating type of baseline has a time interval that repeats over a time period: for example, every Monday from 10:00 AM to 12:00 PM for the year 2007.
To view the AWR Baseline page, click the AWR Baselines link on the Server tab of the Database Instance page (Server > AWR Baselines). On the Baseline page, click Create and follow the wizard instructions to create your baseline.

Note: Before you can set up AWR baseline metric thresholds for a particular baseline, you must compute the baseline statistics. Select Schedule Statistics Computation from the actions menu to compute the baseline statistics. There are several other actions available.

Single AWR Baseline
If you selected the Single option in the previous step, you access the page shown in this slide.
Select the time period corresponding to your interest in one of two ways:
          Select the Snapshot Range option, and then set the period start time and period end time by following the directions on the page. If the icon that you want to select is not shown, you can change the chart time period.

          Specify the time range, with a date and time for start and end times. With the Time Range option, you can choose times in the future.

When you are finished, click Finish to create the static baseline.

Note: If the end time of the baseline is in the future, a baseline template with the same name as the baseline will be created.

Creating a Repeating Baseline Template
You can define repeating baselines by using Enterprise Manager. In the wizard, after selecting Repeating in step 1, you can specify the repeat interval as shown in this slide. You specify the start time and the duration of the baseline. Then specify when the baseline statistics will be collected (daily or weekly; if weekly, for which days). Specify the range of dates for which this baseline template will collect statistics. Retention Time sets an expiration value for the baseline; a value of NULL indicates that the baseline never expires.



How to create repeating Baseline

After click on create select Repeating option you will get the following screen.



Moving Window Baseline


Oracle Database automatically maintains a system-defined moving window baseline. The default window size for the system-defined moving window baseline is the current AWR retention period, which by default is eight days.

If you are planning to use adaptive thresholds, consider using a larger moving window (such as 30 days) to accurately compute threshold values. You can resize the moving window baseline by changing the number of days in the moving window to a value that is equal to or less than the number of days in the AWR retention period. Therefore, to increase the size of a moving window, you first need to increase the AWR retention period accordingly.

The AWR retention period and window size for the system-defined moving window baseline are two separate parameters. The AWR retention period must be greater than or equal to the window size for the system-defined moving window baseline.

This system-defined baseline provides a default baseline for EM performance screens to compare the performance with the current database performance.

Note: The default retention period for snapshot data has been changed from seven days to eight days in Oracle Database 11g to ensure the capture of an entire week of performance data.


Automatic Workload Repository Baselines


In Oracle Database 11g, Automatic Workload Repository (AWR) baselines provide powerful capabilities for defining dynamic and future baselines, and considerably simplify the process of creating and managing performance data for comparison purposes.
Oracle Database 11g has, by default, a system-defined moving window baseline that corresponds to all of the AWR data within the AWR retention period. There can only be one moving window baseline.
Oracle Database 11g provides the ability to collect two kinds of baselines: static baselines  and moving window.
Static baselines can be either single or repeating. A single AWR baseline is collected over a single time period. A repeating baseline is collected over a repeating time period (for example, every Monday in June).
In Oracle Database 11g, baselines are enabled by default if STATISTICS_LEVEL=TYPICAL or ALL.


Sunday, December 8, 2013

Limit the Scope

Does the performance issue originate in the operating system (OS), the instance, or the application SQL? This question is not always easy to answer. 


  • For e.g. Poorly performing SQL can cause excessive physical reads and writes, appearing to be an I/O issue.
  • Improperly sized memory components (an instance configuration issue) can lead to excessive swapping in the OS. 
  • Poor disk configuration can appear to be an instance configuration problem, causing a large redo file waits or commit waits, and other problems.

Does the performance issue originate in the operating system (OS), the instance, or the application SQL? This question is not always easy to answer. Poorly performing SQL can cause excessive physical reads and writes, appearing to be an I/O issue. Improperly sized memory components (an instance configuration issue) can lead to excessive swapping in the OS. Poor disk configuration can appear to be an instance configuration problem, causing a large redo file waits or commit waits, and other problems.

Eliminate possibilities. When the instance appears to have I/O problems, compare the instance file I/O statistics to OS level statistics. The differences can guide you to the actual problem. For example: A higher than normal average wait time on a particular tablespace, could be due to: 

  • Hardware: A file is on a slow drive or an improper RAID configuration.
  • OS: The OS is busy with other files on the same drive or partition.
  • Instance: The tablespace was created with different properties than other tablespaces have, other busy database files are on the same disk or partition (the database I/O is not balanced across all the drives), or the objects being accessed are mostly in the same tablespace, file, or disk. 
  • Application: The application is doing excessive I/O due to poor access path choice by the optimizer due to out of date statistics, inefficient indexes, or other reasons.

Determine the scope of the problem to focus your efforts on the solutions that provide the most benefit.

AWR is the infrastructure


AWR is the infrastructure that provides services to Oracle Database 11g components to collect, maintain, and utilize statistics for problem detection and self-tuning purposes.
The AWR infrastructure consists of two major parts:
An in-memory statistics collection facility that is used by various components to collect statistics. These statistics are stored in memory for performance reasons. Statistics stored in memory are accessible through dynamic performance (V$) views.
AWR snapshots represent the persistent portion of the facility. The AWR snapshots are accessible through data dictionary (DBA) views and Database Control.
Statistics are stored in persistent storage for several reasons:
The statistics need to survive instance crashes.
Historical data for baseline comparisons is needed for certain types of analysis.
Memory overflow: When old statistics are replaced by new ones due to memory shortage, the replaced data can be stored for later use.
The memory version of the statistics is transferred to disk on a regular basis by a background process called MMON (Manageability Monitor).

With AWR, the Oracle database server provides a way to capture historical statistics data automatically, without the intervention of DBAs.

Automatic Workload Repository Data


AWR captures a variety of statistics. AWR stores base statistics, that is, counters and value statistics (for example, log file switches and process memory allocated). AWR captures SQL statistics such as disk reads per SQL statement. Metrics such as physical reads per minute are also captured.
The Active Session History (ASH) data is captured first to memory at one-second intervals for only those sessions that are currently active (performing a database call). Then the ASH data is reduced by a factor of ten by storing to disk a random sample of the in-memory data. The ASH data is heavily used by Automatic Database Diagnostic Monitor (ADDM) to identify root causes of performance issues.
The advisor reports produced by ADDM, the Segment Advisor, and other advisors are also stored in AWR for later viewing.
The statistics exist at two levels: the in-memory recent statistics in V$ views, and persistent statistics that are stored on disk as snapshots and DBA_* views.


AWR Snapshot Purging Policy


You control the amount of historical AWR statistics by setting a retention period and a snapshot interval. In general, snapshots are removed automatically in chronological order. Snapshots that belong to baselines are retained until their baselines are removed or expire. On a typical system with 10 active sessions, AWR collections require 200 MB to 300 MB of space if the data is kept for seven days. The space consumption depends mainly on the number of active sessions in the system. A sizing script, utlsyxsz.sql, includes factors such as the size of the current occupants of the SYSAUX tablespace, number of active sessions, frequency of snapshots, and retention time. The awrinfo.sql script produces a report of the estimated growth rates of various occupants of the SYSAUX tablespace. Both scripts are located in the $ORACLE_HOME/rdbms/admin directory.

AWR handles space management for the snapshots. Every night the MMON process purges snapshots that are older than the retention period. If AWR detects that SYSAUX is out of space, it automatically reuses the space occupied by the oldest set of snapshots by deleting them. An alert is then sent to the DBA to indicate that SYSAUX is under space pressure.

Automatic Workload Repository: Overview

Awr Reports

AWR is the infrastructure that provides services to Oracle Database 11g components to collect, maintain, and utilize statistics for problem detection and self-tuning purposes.

  The AWR infrastructure consists of two major parts:

An in-memory statistics collection facility that is used by various components to collect statistics. These statistics are stored in memory for performance reasons. Statistics stored in memory are accessible through dynamic performance (V$) views.
  • AWR snapshots represent the persistent portion of the facility. The AWR snapshots are accessible through data dictionary (DBA) views and Database Control.
  • The memory version of the statistics is transferred to disk on a regular basis by a background process called MMON (Manageability Monitor).

Important Links:

Friday, December 6, 2013

OS Statistics from AWR Reports

There are occassions when it is important to review the "Operating System Statistics" section of the AWR Report. Examples can be :
1. The Database under review is not the only database on the server and one or more other database(s) and/or other application(s) are contending for CPU (and I/O !) resources. If you are reviewing an AWR report for a set of jobs which are CPU intensive (eg high "consistent gets", high "latch waits" and "latch spins" etc), then it is also important to know if adequate CPU was available for the database. You may or may not have been informed of the other database(s) and/or application(s) running on the same server before you begin reviewing AWR reports.
2. The application tier for the database under consideration is on the same server. When you are investigating high "SQL*Net message from client" waits for batch jobs where you know that neither network latency nor user think time would be the cause of these waits, you need to know if CPU resources are being consumed by the application as well.

Pre-10g, there was no method to obtain OS performance statistics from within Oracle. StatsPack would show elapsed time and Oracle time but not any information about CPU usage outside of 'CPU used by this session' and 'CPU used when call started' -- ie CPU usage reported against the same database's sessions.

10g AWR Reports do provide Operating System statistics.

Here are some examples.

Example 1 :
For these 11.8 minutes :

              Snap Id      Snap Time      Sessions Curs/Sess
            --------- ------------------- -------- ---------
Begin Snap:       211 24-Feb-08 22:45:15        21       3.1
  End Snap:       212 24-Feb-08 22:57:03        18       1.9
   Elapsed:               11.80 (mins)
   DB Time:                0.31 (mins)

we see :


Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
RMAN backup & recovery I/O            1,681          82     49  437.9 System I/O
control file sequential read          3,800          20      5  109.4 System I/O
control file parallel write             526           5      9   24.2 System I/O
CPU time                                              3          16.2
db file sequential read                 236           2      8    9.6   User I/O

Statistic Name                                       Time (s) % of DB Time
------------------------------------------ ------------------ ------------
sql execute elapsed time                                 15.5         82.7
inbound PL/SQL rpc elapsed time                           3.5         18.6
PL/SQL execution elapsed time                             3.3         17.5
DB CPU                                                    3.0         16.2
RMAN cpu time (backup/restore)                            2.0         10.8
parse time elapsed                                        0.5          2.9
hard parse elapsed time                                   0.5          2.6

So, Oracle CPU time was only about 3 seconds. Was the server also doing something else ?
These are the Operating System statistics from the AWR Report :


Statistic                                       Total
-------------------------------- --------------------
AVG_BUSY_TIME                                  43,445
AVG_IDLE_TIME                                  27,531
AVG_SYS_TIME                                    4,977
AVG_USER_TIME                                  38,468
BUSY_TIME                                      43,445
IDLE_TIME                                      27,531
SYS_TIME                                        4,977
USER_TIME                                      38,468
...
NUM_CPUS                                            1

These OS CPU statistics account for 709.76seconds(BUSY+IDLE time).
If Oracle accounted for 3seconds of CPU time, then it seems as if some other processes accounted for 381.68 seconds(384.68-3).

Also, the Operating System statistics show that the CPU utilisation [including %sys] was 61.21% (434.45 of 709.76 seconds).

Example 2:
For these 3 hours :


              Snap Id      Snap Time      Sessions Curs/Sess
            --------- ------------------- -------- ---------
Begin Snap:       213 25-Feb-08 00:01:00        18       1.9
  End Snap:       216 25-Feb-08 03:00:40        18       1.9
   Elapsed:              179.67 (mins)
   DB Time:                0.09 (mins)

we see :


Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
control file sequential read          6,096           7      1  124.0 System I/O
control file parallel write           3,593           4      1   77.7 System I/O
CPU time                                              3          50.4
db file parallel write                1,790           1      1   25.7 System I/O
db file sequential read                  49           1     13   12.0   User I/O

Oracle CPU time was 3seconds.
But was the server CPU really idle ?


Statistic                                       Total
-------------------------------- --------------------
AVG_BUSY_TIME                                 721,220
AVG_IDLE_TIME                                 356,777
AVG_SYS_TIME                                    5,531
AVG_USER_TIME                                 715,689
BUSY_TIME                                     721,220
IDLE_TIME                                     356,777
SYS_TIME                                        5,531
USER_TIME                                     715,689
NUM_CPUS                                            1

These statistics show us that CPU %utilisation [including %sys] 
on the server was 66.90% (7212.22seconds out of 10,779.97seconds).
The server was, actually, quite busy -- busy doing something else. Those CPU cycles were consumed by some other application, not being Oracle.

AWR Reports


AWR Reports


Introduction
AWR periodically gathers and stores system activity and workload data which is then analyzed by ADDM. Every layer of Oracle is equipped with instrumentation that gathers information on workload which will then be used to make self-managing decisions. AWR is the place where this data is stored. AWR looks periodically at the system performance (by default every 60 minutes) and stores the information found (by default up to 7 days). AWR runs by default and Oracle states that it does not add a noticeable level of overhead. A new background server process (MMON) takes snapshots of the in-memory database statistics (much like STATSPACK) and stores this information in the repository. MMON also provides Oracle with a server initiated alert feature, which notifies database administrators of potential problems (out of space, max extents reached, performance thresholds, etc.). The information is stored in the SYSAUX tablespace. This information is the basis for all self-management decisions.

To access Automatic Workload Repository through Oracle Enterprise Manager Database Control:
    On the Administration page, select the Workload Repository link under Workload. From the Automatic Workload Repository page, you can manage snapshots or modify AWR settings.
          o To manage snapshots, click the link next to Snapshots or Preserved Snapshot Sets. On the Snapshots or Preserved Snapshot Sets pages, you can:
                + View information about snapshots or preserved snapshot sets (baselines).
                + Perform a variety of tasks through the pull-down Actions menu, including creating additional snapshots, preserved snapshot sets from an existing range of snapshots, or an ADDM task to perform analysis on a range of snapshots or a set of preserved snapshots.
          o To modify AWR settings, click the Edit button. On the Edit Settings page, you can set the Snapshot Retention period and Snapshot Collection interval.


Most informative sections of the report
I find the following sections most useful:
- Summary
- Top 5 timed events
- Top SQL (by elapsed time, by gets, sometimes by reads)

When viewing AWR report, always check corresponding ADDM report for actionable recommendations. ADDM is a self diagnostic engine designed from the experience of Oracle’s best tuning experts. Analyzes AWR data automatically after an AWR snapshot. Makes specific performance recommendations.


Both the snapshot frequency and retention time can be modified by the user. To see the present settings, you could use:
select snap_interval, retention from dba_hist_wr_control;

SNAP_INTERVAL       RETENTION
------------------- -------------------
+00000 01:00:00.0   +00007 00:00:00.0

or
select dbms_stats.get_stats_history_availability from dual;
select dbms_stats.get_stats_history_retention from dual;
This SQL shows that the snapshots are taken every hour and the collections are retained for 7 days

If you want to extend that retention period you can execute:
execute dbms_workload_repository.modify_snapshot_settings(
      interval => 60,        -- In Minutes. Current value retained if NULL.      retention => 43200);   -- In Minutes (= 30 Days). Current value retained if NULL

In this example the retention period is specified as 30 days (43200 min) and the interval between each snapshot is 60 min.


Differences between AWR and STATSPACK report 
1)Statspack snapshot purges must be scheduled manually. When the Statspack tablespace runs out of space, Statspack quits working. AWR snapshots are purged automatically by MMON every night. MMON, by default, tries to keep one week's worth of AWR snapshots available. If AWR detects that the SYSAUX tablespace is in danger of running out of space, it will free space in SYSAUX by automatically deleting the oldest set of snapshots. If this occurs, AWR will initiate a server-generated alert to notify administrators of the out-of-space error condition.

2)The AWR repository holds all of the statistics available in STATSPACK as well as some additional statistics which are not.

3)STATSPACK does not store the Active Session History (ASH) statistics which are available in the AWR dba_hist_active_sess_history view.

4)STATSPACK does not store history for new metric statistics introduced in Oracle. The key AWR views are: dba_hist_sysmetric_history and dba_hist_sysmetric_summary.

5)The AWR also contains views such as dba_hist_service_stat , dba_hist_service_wait_class and dba_hist_service_name , which store history for performance cumulative statistics tracked for specific services.

6)The latest version of STATSPACK included with Oracle contains a set of specific tables, which track history of statistics that reflect the performance of the Oracle Streams feature. These tables are stats$streams_capture , stats$streams_apply_sum , stats$buffered_subscribers , stats$rule_set , stats$propagation_sender , stats$propagation_receiver and stats$buffered_queues . The AWR does not contain the specific tables that reflect Oracle Streams activity; therefore, if a DBA relies heavily on the Oracle Streams feature, it would be useful to monitor its performance using STATSPACK utility.

7)Statspack snapshots must be run by an external scheduler (dbms_jobs, CRON, etc.). AWR snapshots are scheduled every 60 minutes by default.

8)ADDM captures a much greater depth and breadth of statistics than Statspack does. During snapshot processing, MMON transfers an in-memory version of the statistics to the permanent statistics tables.




Workload Repository Reports
Oracle provide two main scripts to produce workload repository reports. 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

There are other scripts too, here is the full list:

REPORT NAMESQL Script
Automatic Workload Repository Reportawrrpt.sql
Automatic Database Diagnostics Monitor Reportaddmrpt.sql
ASH Reportashrpt.sql
AWR Diff Periods Reportawrddrpt.sql
AWR Single SQL Statement Reportawrsqrpt.sql
AWR Global Reportawrgrpt.sql
AWR Global Diff Reportawrgdrpt.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. This script looks like Statspack; it shows all the AWR snapshots available and asks for two specific ones as interval boundaries. 


AWR Snapshots and Baselines
You can create a snapshot manually using:
EXEC dbms_workload_repository.create_snapshot; 

You can see what snapshots are currently in the AWR by using the DBA_HIST_SNAPSHOT view as seen in this example:

SELECT snap_id, to_char(begin_interval_time,'dd/MON/yy hh24:mi') Begin_Interval,
       
to_char(end_interval_time,'dd/MON/yy hh24:mi') End_Interval
FROM dba_hist_snapshot
ORDER BY 1;

   SNAP_ID BEGIN_INTERVAL  END_INTERVAL
---------- --------------- ---------------
       954 30/NOV/05 03:01 30/NOV/05 04:00
       955 30/NOV/05 04:00 30/NOV/05 05:00
       956 30/NOV/05 05:00 30/NOV/05 06:00
       957 30/NOV/05 06:00 30/NOV/05 07:00
       958 30/NOV/05 07:00 30/NOV/05 08:00
       959 30/NOV/05 08:00 30/NOV/05 09:00


Each snapshot is assigned a unique snapshot ID that is reflected in the SNAP_ID column. The END_INTERVAL_TIME column displays the time that the actual snapshot was taken.

Sometimes you might want to drop snapshots manually. The dbms_workload_repository.drop_snapshot_range procedure can be used to remove a range of snapshots from the AWR. This procedure takes two parameters, low_snap_id and high_snap_id, as seen in this example:

EXEC dbms_workload_repository.drop_snapshot_range(low_snap_id=>1107, high_snap_id=>1108);

The following workload repository views are available:
    * V$ACTIVE_SESSION_HISTORY - Displays the active session history (ASH) sampled every second.
    * V$METRIC - Displays metric information.
    * V$METRICNAME - Displays the metrics associated with each metric group.
    * V$METRIC_HISTORY - Displays historical metrics.
    * V$METRICGROUP - Displays all metrics groups.
    * DBA_HIST_ACTIVE_SESS_HISTORY - Displays the history contents of the active session history.
    * DBA_HIST_BASELINE - Displays baseline information.
    * DBA_HIST_DATABASE_INSTANCE - Displays database environment information.
    * DBA_HIST_SNAPSHOT - Displays snapshot information.
    * DBA_HIST_SQL_PLAN - Displays SQL execution plans.
    * DBA_HIST_WR_CONTROL - Displays AWR settings.

Finally , you can use the following query to identify the occupants of the SYSAUX Tablespace

select substr(occupant_name,1,40), space_usage_kbytes 
   from v$sysaux_occupants;


AWR Automated Snapshots
Oracle uses a scheduled job, GATHER_STATS_JOB, to collect AWR statistics. This job is created, and enabled automatically, when you create a new Oracle database. To see this job, use the DBA_SCHEDULER_JOBS view as seen in this example:
SELECT a.job_name, a.enabled, c.window_name, c.schedule_name, c.start_date, c.repeat_interval
FROM dba_scheduler_jobs a, dba_scheduler_wingroup_members b, dba_scheduler_windows c
WHERE job_name='GATHER_STATS_JOB'
  And a.schedule_name=b.window_group_name
  And b.window_name=c.window_name;

You can disable this job using the dbms_scheduler.disable procedure as seen in this example:
Exec dbms_scheduler.disable('GATHER_STATS_JOB');
And you can enable the job using the dbms_scheduler.enable procedure as seen in this example:
Exec dbms_scheduler.enable('GATHER_STATS_JOB');

AWR Baselines
It is frequently a good idea to create a baseline in the AWR. A baseline is defined as a range of snapshots that can be used to compare to other pairs of snapshots. The Oracle database server will exempt the snapshots assigned to a specific baseline from the automated purge routine. Thus, the main purpose of a baseline is to preserve typical runtime statistics in the AWR repository, allowing you to run the AWR snapshot reports on the preserved baseline snapshots at any time and compare them to recent snapshots contained in the AWR. This allows you to compare current performance (and configuration) to established baseline performance, which can assist in determining database performance problems.

Creating baselines
You can use the create_baseline procedure contained in the dbms_workload_repository stored PL/SQL package to create a baseline as seen in this example:
EXEC dbms_workload_repository.create_baseline (start_snap_id=>1109, end_snap_id=>1111, baseline_name=>'EOM Baseline');

Baselines can be seen using the DBA_HIST_BASELINE view as seen in the following example:
SELECT baseline_id, baseline_name, start_snap_id, end_snap_id
FROM dba_hist_baseline;

BASELINE_ID BASELINE_NAME   START_SNAP_ID END_SNAP_ID
----------- --------------- ------------- -----------
          1 EOM Baseline             1109        1111

In this case, the column BASELINE_ID identifies each individual baseline that has been defined. The name assigned to the baseline is listed, as are the beginning and ending snapshot IDs.

Removing baselines
The pair of snapshots associated with a baseline are retained until the baseline is explicitly deleted. You can remove a baseline using the dbms_workload_repository.drop_baseline procedure as seen in this example that drops the “EOM Baseline” that we just created.
EXEC dbms_workload_repository.drop_baseline (baseline_name=>'EOM Baseline', Cascade=>FALSE);

Note that the cascade parameter will cause all associated snapshots to be removed if it is set to TRUE; otherwise, the snapshots will be cleaned up automatically by the AWR automated processes.



Quick Summary on AWR Sections
This section contains detailed guidance for evaluating each section of an AWR report.
Report Summary Section:
This gives an overall summary of the instance during the snapshot period, and it contains important aggregate summary information.
- Cache Sizes: This shows the size of each SGA region after AMM has changed them.  This information can be compared to the original init.ora parameters at the end of the AWR report.
- Load Profile: This section shows important rates expressed in units of per second and transactions per second.
- Instance Efficiency Percentages: With a target of 100%, these are high-level ratios for activity in the SGA.
- Shared Pool Statistics: This is a good summary of changes to the shared pool during the snapshot period.
- Top 5 Timed Events: This is the most important section in the AWR report.  It shows the top wait events and can quickly show the overall database bottleneck.

Wait Events Statistics Section
This section shows a breakdown of the main wait events in the database including foreground and background database wait events as well as time model, operating system, service, and wait classes statistics.
Time Model Statistics: Time mode statistics report how database-processing time is spent. This section contains detailed timing information on particular components participating in database processing.
- Wait Class: 
- Wait Events: This AWR report section provides more detailed wait event information for foreground user processes which includes Top 5 wait events and many other wait events that occurred during the snapshot interval.
- Background Wait Events: This section is relevant to the background process wait events.
Operating System Statistics: The stress on the Oracle server is important, and this section shows the main external resources including I/O, CPU, memory, and network usage.
- Service Statistics: The service statistics section gives information about how particular services configured in the database are operating.
- Service Wait Class Stats: 

SQL Statistics Section
This section displays top SQL, ordered by important SQL execution metrics.
SQL Ordered by Elapsed Time: Includes SQL statements that took significant execution time during processing.
SQL Ordered by CPU Time: Includes SQL statements that consumed significant CPU time during its processing.
SQL Ordered by Gets: These SQLs performed a high number of logical reads while retrieving data.
SQL Ordered by Reads: These SQLs performed a high number of physical disk reads while retrieving data.
SQL Ordered by Executions: 
SQL Ordered by Parse Calls: These SQLs experienced a high number of reparsing operations.
SQL Ordered by Sharable Memory: Includes SQL statements cursors which consumed a large amount of SGA shared pool memory.
SQL Ordered by Version Count: These SQLs have a large number of versions in shared pool for some reason.
Complete List of SQL Text: 

Instance Activity Stats

This section contains statistical information describing how the database operated during the snapshot period.
Instance Activity Stats - Absolute Values: This section contains statistics that have absolute values not derived from end and start snapshots.
Instance Activity Stats - Thread Activity: This report section reports a log switch activity statistic.

I/O Stats Section

This section shows the all important I/O activity for the instance and shows I/O activity by tablespace, data file, and includes buffer pool statistics.
- Tablespace IO Stats 
- File IO Stats 

Buffer Pool Statistics Section

Advisory Statistics Section
This section show details of the advisories for the buffer, shared pool, PGA and Java pool.
Instance Recovery Stats: 
Buffer Pool Advisory: 
PGA Aggr Summary: PGA Aggr Target Stats; PGA Aggr Target Histogram; and PGA Memory Advisory. 
Shared Pool Advisory: 
SGA Target Advisory
Stream Spool Advisory
Java Pool Advisory 

Wait Statistics Section
- Buffer Wait Statistics: 
This important section shows buffer cache waits statistics.
- Enqueue Activity: This important section shows how enqueue operates in the database. Enqueues are special internal structures which provide concurrent access to various database resources.

Undo Statistics Section
- Undo Segment Summary: This section gives a summary about how undo segments are used by the database.
- Undo Segment Stats: This section shows detailed history information about undo segment activity.

Latch Statistics Section:
This section shows details about latch statistics. Latches are a lightweight serialization mechanism that is used to single-thread access to internal Oracle structures.
- Latch Activity
- Latch Sleep Breakdown
- Latch Miss Sources
- Parent Latch Statistics
- Child Latch Statistics

Segment Statistics Section:
This report section provides details about hot segments using the following criteria:
Segments by Logical Reads: Includes top segments which experienced high number of logical reads.
Segments by Physical Reads: Includes top segments which experienced high number of disk physical reads.
Segments by Row Lock Waits: Includes segments that had a large number of row locks on their data.
Segments by ITL Waits: Includes segments that had a large contention for Interested Transaction List (ITL). The contention for ITL can be reduced by increasing INITRANS storage parameter of the table.
Segments by Buffer Busy Waits: These segments have the largest number of buffer waits caused by their data blocks.

Dictionary Cache Stats Section
This section exposes details about how the data dictionary cache is operating.

Library Cache Section
Includes library cache statistics describing how shared library objects are managed by Oracle.

Memory Statistics Section- Process Memory Summary
- SGA Memory Summary: This section provides summary information about various SGA regions.
- SGA Breakdown difference: 

Streams Statistics Section
- Streams CPU/IO Usage
- Streams Capture
- Streams Apply
- Buffered Queues
- Buffered Subscribers
- Rule Set


Reading the AWR Report
The main sections in an AWR report include:

AWR Report Header:
This section shows basic information about the report like when the snapshot was taken, for how long, Cache Sizes at the beginning and end of the Snapshot, etc.

WORKLOAD REPOSITORY report for

DB NameDB IdInstanceInst numStartup TimeReleaseRAC
FGUARD750434027FGUARD103-Jul-13 21:0711.2.0.2.0NO
Host NamePlatformCPUsCoresSocketsMemory (GB)
atl-frauddb-04.fiservipo.comLinux x86 64-bit168211.72

Snap IdSnap TimeSessionsCursors/Session
Begin Snap:2081308-Jul-13 00:00:192673.1
End Snap:2085409-Jul-13 15:54:142783.6
Elapsed: 2,393.91 (mins)  
DB Time: 4,689.46 (mins)  


Cache Sizes

BeginEnd

Buffer Cache:1,520M1,344MStd Block Size:8K
Shared Pool Size:1,120M1,296MLog Buffer:8,632K

Elasped Time: It represents the snapshot window or the time between the two snapshots.
DB TIME: Represents the activity on the database.

If DB TIME is Greater than Elapsed Time then it means that database has high workload.



Load Profile: 
The load profile provides an at-a-glance look at some specific operational statistics. You can compare these statistics with a baseline snapshot report to determine if database activity is different. Values for these statistics are presented in two formats. The first is the value per second (for example, how much redo was generated per second) and the second is the value per transaction (for example, 1,024 bytes of redo were generated per transaction).


Per SecondPer TransactionPer ExecPer Call
DB Time(s):2.00.90.020.02
DB CPU(s):0.50.20.010.01
Redo size:25,972.212,131.8  
Logical reads:9,444.64,411.6  
Block changes:144.767.6  
Physical reads:8,671.9 4,050.7  
Physical writes:2,641.51,233.9  
User calls:83.939.2  
Parses:30.714.3  
Hard parses:0.40.2  
W/A MB processed:4.62.1  
Logons:2.51.2  
Executes:88.641.4  
Rollbacks:0.00.0  
Transactions:2.1   

Where:
DB time(s): It's the amount of time oracle has spent performing database user calls. Note it does not include background processes.
DB CPU(s): It's the amount of CPU time spent on user calls. As DB time, it does not include background process. The value is in microseconds
Redo size: This is the amount of DML happening in the DB. If you see an increase here then more DML statements are taking place (meaning your users are doing more INSERTs, UPDATEs, and DELETEs than before). For example, the table below shows that an average transaction generates about 12,000 of redo data along with around 26,000 redo per second.
Logical reads: This is calculated as Consistent Gets + DB Block Gets =  Logical Reads
Block Changes: The number of blocks modified during the sample interval. If you see an increase here then more DML statements are taking place (meaning your users are doing more INSERTs, UPDATEs, and DELETEs than before).
Physical reads: The number of requests for a block that caused a physical I/O.
Physical writes: Number of physical writes performed
User calls: Indicates how many user calls have occurred during the snapshot period. This value can give you some indication if usage has increased.
Parses: The total of all parses; both hard and soft.
Hard Parses: Those parses requiring a completely new parse of the SQL statement.  A ‘hard parse’ rate of greater than 100 per second indicates there is a very high amount of hard parsing on the system. High hard parse rates cause serious performance issues, and must be investigated. A high hard parse rate is usually accompanied by latch contention on the shared pool and library cache latches. Check whether waits for ‘latch free’ appear in the top-5 wait events, and if so, examine the latching sections of the report. Of course, we want a low number here. Possible reasons for excessive hard parses may be a small shared pool or may be that bind variables are not being used.
Soft Parses: Not listed but derived by subtracting the hard parses from parses.  A soft parse reuses a previous hard parse and hence consumes far fewer resources. A high soft parse rate could be anywhere in the rate of 300 or more per second. Unnecessary soft parses also limit application scalability; optimally a SQL statement should be soft-parsed once per session, and executed many times.
Sorts: Number of sorts occurring in the database
Logons: No of logons during the interval
Executes: how many statements we are executing per second / transaction
Transactions: How many transactions per second we process 

The per-second statistics show you the changes in throughput (i.e. whether the instance is performing more work per second). For example:
• a significant increase in ‘redo size’, ‘block changes’ and ‘pct of blocks changed per read’ would indicate the instance is performing more inserts/updates/deletes.
• an increase in the ‘redo size’ without an increase in the number of ‘transactions per second’ would indicate a changing transaction profile.
Similarly, looking at the per-transaction statistics allows you to identify changes in the application characteristics by comparing these to the corresponding statistics from the baseline report.
Additionally, the load profile section provides the percentage of blocks that were changed per read, the percentage of recursive calls that occurred, the percentage of transactions that were rolled back and the number of rows sorted per sort operation.

In this example
• Comparing the number of Physical reads per second to the number of Physical writes per second shows the physical read to physical write ratio is very high. Typical OLTP systems have a read-to-write ratio of 10:1 or 5:1
• This system is busy, with 84 User calls per second.


Instance Efficiency Percentages (Target 100%)
These statistics include several buffer related ratios including the buffer hit percentage and the library hit percentage. Also, shared pool memory usage statistics are included in this section.
Buffer Nowait %:100.00Redo NoWait %:100.00
Buffer Hit %:99.32In-memory Sort %:100.00
Library Hit %:98.94Soft Parse %:97.25
Execute to Parse %:75.00Latch Hit %:98.78
Parse CPU to Parse Elapsd %:22.99% Non-Parse CPU:99.93

Buffer Nowait Ratio. This is the percentage of time that the instance made a call to get a buffer (all buffer types are included here) and that buffer was made available immediately (meaning it didn't have to wait for the buffer...hence "Buffer Nowait"). If the ratio is low, then could be a (hot) block(s) being contended for that should be found in the Buffer Wait Section.. If the ratio is low, check the Buffer Wait Statistics section of the report for more detail on which type of block is being contended for.
Buffer Hit Ratio. (also known as the buffer-cache hit ratio) Ideally more than 95 percent. It shows the % of times a particular block was found in buffer cache insted of performing a physical I/O (reading from disk).
Although historically known as one of the most important statistics to evaluate, this ratio can sometimes be misleading. A low buffer hit ratio does not necessarily mean the cache is too small; it may be that potentially valid full-table scans are artificially reducing what is otherwise a good ratio. Similarly, a high buffer hit ratio (say, 99 percent) normally indicates that the cache is adequately sized, but this assumption may not always be valid. For example, frequently executed SQL statements that repeatedly refer to a small number of buffers via indexed lookups can create a misleadingly high buffer hit ratio. When these buffers are read, they are placed at the most recently used (MRU) end of the buffer cache; iterative access to these buffers can artificially inflate the buffer hit ratio. This inflation makes tuning the buffer cache a challenge. Sometimes you can identify a too-small buffer cache by the appearance of the write complete waits event, which indicates that hot blocks (that is, blocks that are still being modified) are aging out of the cache while they are still needed; check the Wait Events list for evidence of this event. If the number is negative, the BUFFER_CACHE is too small and the data is bein aged out before it can be used.
Library Hit Ratio. This ratio, also known as the library-cache hit ratio, gives the percentage of pin requests that result in pin hits. A pin hit occurs when the SQL or PL/SQL code to be executed is already in the library cache and is valid to execute. If the "Library Hit ratio" is low, it could be indicative of a shared pool that is too small (SQL is prematurely pushed out of the shared pool), or just as likely, that the system did not make correct use of bind variables in the application. If the soft parse ratio is also low, check whether there's a parsing issue. A lower ratio could also indicate that bind variables are not used or some other issue is causing SQL not to be reused (in which case a smaller shared pool may only be a band-aid that will potentially fix a library latch problem which may result).
Execute to Parse. If value is negative, it means that the number of parses is larger than the number of executions. Another cause for a negative execute to parse ratio is if the shared pool is too small and queries are aging out of the shared pool and need to be reparsed.  This is another form of thrashing which also degrades performance tremendously. So, if you run some SQL and it has to be parsed every time you execute it (because no plan exists for this statement) then your percentage would be 0%. The more times that your SQL statement can reuse an existing plan the higher your Execute to Parse ratio is. This is very BAD!! One way to increase your parse ratio is to use bind variables.
Parse CPU to Parse Elapsd %: Generally, this is a measure of how available your CPU cycles were for SQL parsing. If this is low, you may see "latch free" as one of your top wait events.
Redo Nowait Ratio.
 This ratio indicates the amount of redo entries generated for which there was space available in the redo log. The instance didn't have to wait to use the redo log if this is 100%
The redo-log space-request statistic is incremented when an Oracle process attempts to write a redo-log entry but there is not sufficient space remaining in the online redo log. Thus, a value close to 100 percent for the redo nowait ratio indicates minimal time spent waiting for redo logs to become available, either because the logs are not filling up very often or because the database is able to switch to a new log quickly whenever the current log fills up.
If your alert log shows that you are switching logs frequently (that is, more than once every 15 minutes), you may be able to reduce the amount of switching by increasing the size of the online redo logs. If the log switches are not frequent, check the disks on which the redo logs reside to see why the switches are not happening quickly. If these disks are not overloaded, they may be slow, which means you could put the files on faster disks.
In-Memory Sort Ratio. This ratio gives the percentage of sorts that were performed in memory, rather than requiring a disk-sort segment to complete the sort. Optimally, in an OLTP environment, this ratio should be high. Setting the PGA_AGGREGATE_TARGET (or SORT_AREA_SIZE) initialization parameter effectively will eliminate this problem, as a minimum you pretend to have this one in 95%
Soft Parse Ratio. This ratio gives the percentage of parses that were soft, as opposed to hard. A soft parse occurs when a session attempts to execute a SQL statement and a usable version of the statement is already in the shared pool. In other words, all data (such as the optimizer execution plan) pertaining to the statement in the shared pool is equally applicable to the statement currently being issued. A hard parse, on the other hand, occurs when the current SQL statement is either not in the shared pool or not there in a shareable form. An example of the latter case would be when the SQL statement in the shared pool is textually identical to the current statement but the tables referred to in the two statements resolve to physically different tables.
Hard parsing is an expensive operation and should be kept to a minimum in an OLTP environment. The aim is to parse once, execute many times.
Ideally, the soft parse ratio should be greater than 95 percent. When the soft parse ratio falls much below 80 percent, investigate whether you can share SQL by using bind variables or force cursor sharing by using theinit.ora parameter cursor_sharing.
Before you jump to any conclusions about your soft parse ratio, however, be sure to compare it against the actual hard and soft parse rates shown in the Load Profile. If the rates are low (for example, 1 parse per second), parsing may not be a significant issue in your system. Another useful standard of comparison is the proportion of parse time that was not CPU-related, given by the following ratio:
(parse time CPU) / (parse time elapsed)
A low value for this ratio could mean that the non-CPU-related parse time was spent waiting for latches, which might indicate a parsing or latching problem. To investigate further, look at the shared-pool and library-cache latches in the Latch sections of the report for indications of contention on these latches.
Latch Hit Ratio. This is the ratio of the total number of latch misses to the number of latch gets for all latches. A low value for this ratio indicates a latching problem, whereas a high value is generally good. However, as the data is rolled up over all latches, a high latch hit ratio can artificially mask a low get rate on a specific latch. Cross-check this value with the Top 5 Wait Events to see if latch free is in the list, and refer to the Latch sections of the report. Latch Hit % of less than 99 percent is usually a big problem.
Also check the "Shared Pool Statistics", if the "End" value is in the high 95%-100% range ,this is a indication that the shared pool needs to be increased (especially if the "Begin" value is much smaller)



Example: Evaluating the Instance Efficiency Percentages Section
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Buffer Nowait %:   99.99       Redo NoWait %:  100.00
            Buffer  Hit   %:   95.57    In-memory Sort %:   97.55
            Library Hit   %:   99.89        Soft Parse %:   99.72
         Execute to Parse %:   88.75         Latch Hit %:   99.11
Parse CPU to Parse Elapsd %:   52.66     % Non-Parse CPU:   99.99

Interpreting the ratios in this section can be slightly more complex than it may seem at first glance. While high values for the ratios are generally good (indicating high efficiency), such values can be misleading your system may be doing something efficiently that it would be better off not doing at all. Similarly, low values aren't always bad. For example, a low in-memory sort ratio (indicating a low percentage of sorts performed in memory) would not necessarily be a cause for concern in a decision- support system (DSS) environment, where user response time is less critical than in an online transaction processing (OLTP) environment.
Basically, you need to keep in mind the characteristics of your application - whether it is query-intensive or update-intensive, whether it involves lots of sorting, and so on - when you're evaluating the Instance Efficiency Percentages.
The following ratios should be above 90% in a database.
Buffer Nowait
Buffer  Hit  
Library Hit
Redo NoWait
In-memory Sort
Soft Parse
Latch Hit
Non-Parse CPU

The execute to parse ratio should be very high in a ideal database.
The execute to parse ratio is basically a measure between the number of times a sql is executed versus the number of times it is parsed.
The ratio will move higher as the number of executes go up, while the number of parses either go down or remain the same.
The ratio will be close to zero if the number of executes and parses are almost equal.
The ratio will be negative executes are lower but the parses are higher.


Another Sample Analysis
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Buffer Nowait %:   98.56       Redo NoWait %:  100.00
            Buffer  Hit   %:   99.96    In-memory Sort %:   99.84
            Library Hit   %:   99.99        Soft Parse %:  100.00 (A)
         Execute to Parse %:    0.10 (A)     Latch Hit %:   99.37
Parse CPU to Parse Elapsd %:   58.19 (A) % Non-Parse CPU:   99.84

 Shared Pool Statistics        Begin   End
                               ------  ------
             Memory Usage %:   28.80   29.04 (B)
    % SQL with executions>1:   75.91   76.03
  % Memory for SQL w/exec>1:   83.65   84.09

Observations:
• The 100% soft parse ratio (A) indicates the system is not hard-parsing. However the system is soft parsing a lot, rather than only re-binding and re-executing the same cursors, as the Execute to Parse % is very low (A). Also, the CPU time used for parsing (A) is only 58% of the total elapsed parse time (see Parse CPU to Parse Elapsd). This may also imply some resource contention during parsing (possibly related to the latch free event?).
• There seems to be a lot of unused memory in the shared pool (only 29% is used) (B). If there is insufficient memory allocated to other areas of the database (or OS), this memory could be redeployed

***Please see the following NOTES on shared pool issues
[NOTE:146599.1] Diagnosing and Resolving Error ORA-04031
[NOTE:62143.1] Understanding and Tuning the Shared Pool
[NOTE:105813.1] SCRIPT TO SUGGEST MINIMUM SHARED POOL SIZE 




Shared Pool Statistics


BeginEnd
Memory Usage %:73.8675.42
% SQL with executions>1:92.6193.44
% Memory for SQL w/exec>1:94.3394.98
 Shared Pool Statistics        Begin   End
                               ------  ------
             Memory Usage %:   42.07   43.53
    % SQL with executions>1:   73.79   75.08
  % Memory for SQL w/exec>1:   76.93   77.64
Memory Usage % = It's the shared pool usage. So here we have use 73.86 per cent of our shared pool and out of that almost 94 percent is being re-used. If Memory Usage % is too large like 90 % it could mean that your shared pool is tool small and if the percent is in 50 for example then this could mean that you shared pool is too large
% SQL with executions>1
 = Shows % of SQLs executed more than 1 time. The % should be very near to value 100. If we get a low number here, then the DB is not using shared SQL statements. May be because bind variables are not being used.
% memory for SQL w/exec>1
: From the memory space allocated to cursors, shows which % has been used by cursors more than 1.

Top 5 Timed Foreground Events
This section provides insight into what events the Oracle database is spending most of it's time on (see wait events). Each wait event is listed, along with the number of waits, the time waited (in seconds), the average wait per event (in microseconds) and the associated wait class. This is one of the most important sections of the report.
EventWaitsTime(s)Avg wait (ms)% DB timeWait Class
direct path write temp12,218,833193,6571668.83User I/O
DB CPU 70,609 25.09 
log file sync247,0946,933282.46Commit
db file sequential read221,3015,813262.07User I/O
direct path read6,773,7194,44211.58User I/O
It's critical to look into this section. If you turn off the statistic parameter, then the Time(s) wont appear. Wait analysis should be done with respect to Time(s) as there could be million of waits but if that happens for a second or so then who cares. Therefore, time is very important component.
When you are trying to eliminate bottlenecks on your system, your report's Top 5 Timed Events section is the first place to look and you should use the HIGHEST WAIT TIMES to guide the investigation
As you will see, you have several different types of waits, so let's discuss the most common waits on the next section.





Common WAIT EVENTS

If you want a quick instance wide wait event status, showing which events are the biggest contributors to total wait time, you can use the following query :
select event, total_waits,time_waited from V$system_event
  where event NOT IN
  ('pmon timer', 'smon timer', 'rdbms ipc reply', 'parallel deque wait',
  'virtual circuit', '%SQL*Net%', 'client message', 'NULL event')
order by time_waited desc;

EVENT                              TOTAL_WAITS         TIME_WAITED
------------------------          -------------       -------------
db file sequential read              35051309            15965640
latch free                            1373973             1913357
db file scattered read                2958367             1840810
enqueue                                  2837              370871
buffer busy waits                      444743              252664
log file parallel write                146221              123435



1. DB File Scattered Read. 
That generally happens during full scan of a table or Fast Full Index Scans
As full table scans are pulled into memory, they rarely fall into contiguous buffers but instead are scattered throughout the buffer cache. A large number here indicates that your table may have missing indexes, statistics are not updated or your indexes are not used. Although it may be more efficient in your situation to perform a full table scan than an index scan, check to ensure that full table scans are necessary when you see these waits. Try to cache small tables to avoid reading them in over and over again, since a full table scan is put at the cold end of the LRU (Least Recently Used) list. You can use the report to help identify the query in question and fix it.The init.ora parameter db_file_multiblock_read_count specifies the maximum numbers of blocks read in that way. Typically, this parameter should have values of 4-16 independent of the size of the database but with higher values needed with smaller Oracle block sizes. If you have a high wait time for this event, you either need to reduce the cost of I/O, e.g. by getting faster disks or by distributing your I/O load better, or you need to reduce the amount of full table scans by tuning SQL statements. The appearance of the‘db file scattered read’ and ‘db file sequential read’events may not necessarily indicate a problem, as IO is a normal activity on a healthy instance. However, they can indicate problems if any of the following circumstances are true:
• The data-access method is bad (that is, the SQL statements are poorly tuned), resulting in unnecessary or inefficient IO operations
• The IO system is overloaded and performing poorly
• The IO system is under-configured for the load
• IO operations are taking too long

If this Wait Event is a significant portion of Wait Time then a number of approaches are possible:
o Find which SQL statements perform Full Table or Fast Full Index scans and tune them to make sure these scans are necessary and not the result of a suboptimal plan.
- The view V$SQL_PLAN view can help:
For Full Table scans:
select sql_text from v$sqltext t, v$sql_plan p
  where t.hash_value=p.hash_value
    and p.operation='TABLE ACCESS'

    and p.options='FULL'
  order by p.hash_value, t.piece;

For Fast Full Index scans:
select sql_text from v$sqltext t, v$sql_plan p
  where t.hash_value=p.hash_value
    and p.operation='INDEX'

    and p.options='FULL SCAN'
  order by p.hash_value, t.piece;

o In cases where such multiblock scans occur from optimal execution plans it is possible to tune the size of multiblock I/Os issued by Oracle by setting the instance parameter DB_FILE_MULTIBLOCK_READ_COUNT so that:
DB_BLOCK_SIZE x DB_FILE_MULTIBLOCK_READ_COUNT = max_io_size of system
Query tuning should be used to optimize online SQL to use indexes.

2. DB File Sequential Read. 
Is the wait that comes from the physical side of the database. It related to memory starvation and non selective index use. Sequential read is an index read followed by table read because it is doing index lookups which tells exactly which block to go to.This could indicate poor joining order of tables or un-selective indexes in your SQL or waiting for writes to TEMP space (direct loads, Parallel DML (PDML) such as parallel updates. It could mean that a lot of index reads/scans are going on. Depending on the problem it may help to tune PGA_AGGREGATE_TARGET and/or DB_CACHE_SIZE. The sequential read event identifies Oracle reading blocks sequentially, i.e. one after each other. It is normal for this number to be large for a high-transaction, well-tuned system, but it can indicate problems in some circumstances. You should correlate this wait statistic with other known issues within the report, such as inefficient SQL. Check to ensure that index scans are necessary, and check join orders for multiple table joins. The DB_CACHE_SIZE will also be a determining factor in how often these waits show up. Problematic hash-area joins should show up in the PGA memory, but they're also memory hogs that could cause high wait numbers for sequential reads. They can also show up as direct path read/write waits. These circumstances are usually interrelated. When they occur in conjunction with the appearance of the 'db file scattered read' and 'db file sequential read' in the Top 5 Wait Events section, first you should examine the SQL Ordered by Physical Reads section of the report, to see if it might be helpful to tune the statements with the highest resource usage.
It could be because the indexes are fragmented. If that is the case, rebuilding the index will compact it and will produce to visit less blocks.
Then, to determine whether there is a potential I/O bottleneck, examine the OS I/O statistics for corresponding symptoms. Also look at the average time per read in the Tablespace and File I/O sections of the report. If many I/O-related events appear high in the Wait Events list, re-examine the host hardware for disk bottlenecks and check the host-hardware statistics for indications that a disk reconfiguration may be of benefit.
Block reads are fairly inevitable so the aim should be to minimize unnecessary I/O. I/O for sequential reads can be reduced by tuning SQL calls that result in full table scans and using the partitioning option for large tables.

3. Free Buffer Waits.
When a session needs a free buffer and cannot find one, it will post the database writer process asking it to flush dirty blocks (No place to put a new block). Waits in this category may indicate that you need to increase the DB_BUFFER_CACHE, if all your SQL is tuned. Free buffer waits could also indicate that unselective SQL is causing data to flood the buffer cache with index blocks, leaving none for this particular statement that is waiting for the system to process. This normally indicates that there is a substantial amount of DML (insert/update/delete) being done and that the Database Writer (DBWR) is not writing quickly enough; the buffer cache could be full of multiple versions of the same buffer, causing great inefficiency. To address this, you may want to consider accelerating incremental checkpointing, using more DBWR processes, or increasing the number of physical disks. To investigate if this is an I/O problem, look at the report I/O Statistics. Increase the DB_CACHE_SIZE; shorten the checkpoint; tune the code to get less dirty blocks, faster I/O, use multiple DBWR’s.

4. Buffer Busy Waits. A buffer busy wait happens when multiple processes concurrently want to modify the same block in the buffer cache. This typically happens during massive parallel inserts if your tables do not have free lists and it can happen if you have too few rollback segments. Buffer busy waits should not be greater than 1 percent. Check the Buffer Wait Statistics section (or V$WAITSTAT) to find out if the wait is on a segment header. If this is the case, increase the freelist groups or increase the pctused to pctfree gap. If the wait is on an undo header, you can address this by adding rollback segments; if it's on an undo block, you need to reduce the data density on the table driving this consistent read or increase the DB_CACHE_SIZE. If the wait is on a data block, you can move data to another block to avoid this hot block, increase the freelists on the table, or use Locally Managed Tablespaces (LMTs). If it's on an index block, you should rebuild the index, partition the index, or use a reverse key index. To prevent buffer busy waits related to data blocks, you can also use a smaller block size: fewer records fall within a single block in this case, so it's not as "hot." When a DML (insert/update/ delete) occurs, Oracle writes information into the block, including all users who are "interested" in the state of the block (Interested Transaction List, ITL). To decrease waits in this area, you can increase the initrans, which will create the space in the block to allow multiple ITL slots. You can also increase the pctfree on the table where this block exists (this writes the ITL information up to the number specified by maxtrans, when there are not enough slots built with the initrans that is specified). Buffer busy waits can be reduced by using reverse-key indexes for busy indexes and by partitioning busy tables.
Buffer Busy Wait on Segment Header – Add freelists (if inserts) or freelist groups (esp. RAC). Use ASSM.Buffer Busy Wait on Data Block – Separate ‘hot’ data; potentially use reverse key indexes; fix queries to reduce the blocks popularity, use smaller blocks, I/O, Increase initrans and/or maxtrans (this one’s debatable). Reduce records per block
Buffer Busy Wait on Undo Header – Add rollback segments or increase size of segment area (auto undo)
Buffer Busy Wait on Undo block – Commit more (not too much) Larger rollback segments/area. Try to fix the SQL.


5. Latch Free
.
 Latches are low-level queuing mechanisms (they're accurately referred to as mutual exclusion mechanisms) used to protect shared memory structures in the system global area (SGA). Latches are like locks on memory that are very quickly obtained and released. Latches are used to prevent concurrent access to a shared memory structure. If the latch is not available, a latch free miss is recorded. Most latch problems are related to the failure to use bind variables (library cache latch), redo generation issues (redo allocation latch), buffer cache contention issues (cache buffers LRU chain), and hot blocks in the buffer cache (cache buffers chain). There are also latch waits related to bugs; check MetaLink for bug reports if you suspect this is the case. When latch miss ratios are greater than 0.5 percent, you should investigate the issue. If latch free waits are in the Top 5 Wait Events or high in the complete Wait Events list, look at the latch-specific sections of the report to see which latches are contended for.

6. Enqueue. An enqueue is a lock that protects a shared resource. Locks protect shared resources, such as data in a record, to prevent two people from updating the same data at the same time application, e.g. when a select for update is executed.. An enqueue includes a queuing mechanism, which is FIFO (first in, first out). Note that Oracle's latching mechanism is not FIFO. Enqueue waits usually point to the ST enqueue, the HW enqueue, the TX4 enqueue, and the TM enqueue. The ST enqueue is used for space management and allocation for dictionary-managed tablespaces. Use LMTs, or try to preallocate extents or at least make the next extent larger for problematic dictionary-managed tablespaces. HW enqueues are used with the high-water mark of a segment; manually allocating the extents can circumvent this wait. TX4s are the most common enqueue waits. TX4 enqueue waits are usually the result of one of three issues. The first issue is duplicates in a unique index; you need to commit/rollback to free the enqueue. The second is multiple updates to the same bitmap index fragment. Since a single bitmap fragment may contain multiple rowids, you need to issue a commit or rollback to free the enqueue when multiple users are trying to update the same fragment. The third and most likely issue is when multiple users are updating the same block. If there are no free ITL slots, a block-level lock could occur. You can easily avoid this scenario by increasing the initrans and/or maxtrans to allow multiple ITL slots and/or by increasing the pctfree on the table. Finally, TM enqueues occur during DML to prevent DDL to the affected object. If you have foreign keys, be sure to index them to avoid this general locking issue.
Enqueue - ST Use LMT’s or pre-allocate large extents
Enqueue - HW Pre-allocate extents above HW (high water mark.)
Enqueue – TX Increase initrans and/or maxtrans (TX4) on (transaction) the table or index.  Fix locking issues if TX6.  Bitmap (TX4) & Duplicates in Index (TX4).
Enqueue - TM Index foreign keys; Check application (trans. mgmt.) locking of tables.  DML Locks.

7. Log Buffer Space
Look at increasing log buffer size. This wait occurs because you are writing the log buffer faster than LGWR can write it to the redo logs, or because log switches are too slow. To address this problem, increase the size of the redo log files, or increase the size of the log buffer, or get faster disks to write to. You might even consider using solid-state disks, for their high speed. 

The session is waiting for space in the log buffer. (Space becomes available only after LGWR has written the current contents of the log buffer to disk.) This typically happens when applications generate redo faster than LGWR can write it to disk.

8. Log File Switch
log file switch (checkpoint incomplete): May indicate excessive db files or slow IO subsystem
log file switch (archiving needed):  Indicates archive files are written too slowly
log file switch completion: May need more log files per
May indicate excessive db files or slow IO subsystem. All commit requests are waiting for "logfile switch (archiving needed)" or "logfile switch (chkpt. Incomplete)." Ensure that the archive disk is not full or slow. DBWR may be too slow because of I/O. You may need to add more or larger redo logs, and you may potentially need to add database writers if the DBWR is the problem.

9. Log File Sync
Could indicate excessive commits. A Log File Sync happens each time a commit (or rollback) takes place. If there are a lot of waits in this area then you may want to examine your application to see if you are committing too frequently (or at least more than you need to). When a user commits or rolls back data, the LGWR flushes the session's redo from the log buffer to the redo logs. The log file sync process must wait for this to successfully complete. To reduce wait events here, try to commit more records (try to commit a batch of 50 instead of one at a time, use BULKS, , for example). Put redo logs on a faster disk, or alternate redo logs on different physical disks (with no other DB Files, ASM, etc) to reduce the archiving effect on LGWR. Don't use RAID 5, since it is very slow for applications that write a lot; potentially consider using file system direct I/O or raw devices, which are very fast at writing information. The associated event, ‘log buffer parallel write’ is used by the redo log writer process, and it will indicate if your actual problem is with the log file I/O. Large wait times for this event can also be caused by having too few CPU resources available for the redolog writer process.

10. Idle Event. There are several idle wait events listed after the output; you can ignore them. Idle events are generally listed at the bottom of each section and include such things as SQL*Net message to/from client and other background-related timings. Idle events are listed in the stats$idle_event table.

11. global cache cr request: (OPS) This wait event shows the amount of time that an instance has waited for a requested data block for a consistent read and the transferred block has not yet arrived at the requesting instance. See Note 157766.1 'Sessions Wait Forever for 'global cache cr request' Wait Event in OPS or RAC'. In some cases the 'global cache cr request' wait event may be perfectly normal if large buffer caches are used and the same data is being accessed concurrently on multiple instances.  In a perfectly tuned, non-OPS/RAC database, I/O wait events would be the top wait events but since we are avoiding I/O's with RAC and OPS the 'global cache cr request' wait event often takes the place of I/O wait events.

12. library cache pin: Library cache latch contention may be caused by not using bind variables. It is due to excessive parsing of SQL statement. 
The session wants to pin an object in memory in the library cache for examination, ensuring no other processes can update the object at the same time. This happens when you are compiling or parsing a PL/SQL object or a view.

13. CPU time
This is not really a wait event (hence, the new name), but rather the sum of the CPU used by this session, or the amount of CPU time used during the snapshot window. In a heavily loaded system, if the CPU time event is the biggest event, that could point to some CPU-intensive processing (for example, forcing the use of an index when a full scan should have been used), which could be the cause of the bottleneck. When CPU Other is a significant component of total Response Time the next step is to find the SQL statements that access the most blocks. Block accesses are also known as Buffer Gets and Logical I/Os. The report lists such SQL statements in section SQL ordered by Gets.

14. DB File Parallel Read  If you are doing a lot of partition activity then expect to see that wait even. it could be a table or index partition. This Wait Event is used when Oracle performs in parallel reads from multiple datafiles to non-contiguous buffers in memory (PGA or Buffer Cache). This is done during recovery operations or when buffer prefetching is being used as an optimization i.e. instead of performing multiple single-block reads. If this wait is an important component of Wait Time, follow the same guidelines as 'db file sequential read'. 
This may occur during recovery or during regular activity when a session batches many single block I/O requests together and issues them in parallel.

15. PX qref latch  Can often mean that the Producers are producing data quicker than the Consumers can consume it. Maybe we could increase parallel_execution_message_size to try to eliminate some of these waits or we might decrease the degree of parallelism. If the system workload is high consider to decrease the degree of parallelism. If you have DEFAULT parallelism on your object  you can decrease the value of PARALLEL_THREADS_PER_CPU.  Have in mind  DEFAULT degree = PARALLEL_THREADS_PER_CPU * #CPU's 

16. Log File Parallel Write. It occurs when waiting for writes of REDO records to the REDO log files to complete. The wait occurs in log writer (LGWR) as part of normal activity of copying records from the REDO log buffer to the current online log. The actual wait time is the time taken for all the outstanding I/O requests to complete. Even though the writes may be issued in parallel, LGWR needs to wait for the last I/O to be on disk before the parallel write is considered complete. Hence the wait time depends on the time it takes the OS to complete all requests.
Log file parallel write waits can be reduced by moving log files to the faster disks and/or separate disks where there will be less contention.

17. SQL*Net more data to client
This means the instance is sending a lot of data to the client. You can decrease this time by having the client bring back less data. Maybe the application doesn't need to bring back as much data as it is.

18. SQL*Net message to client
The “SQL*Net message to client” Oracle metric indicates the server (foreground process) is sending a message to the client, and it can be used to identify throughput issues over a network, especially distributed databases with slow database links. The SQL*Net more data to client event happens when Oracle writes multiple data buffers (sized per SDU) in a single logical network call.

19. enq: TX - row lock contention:
Oracle keeps data consistency with the help of locking mechanism. When a particular row is being modified by the process, either through Update/ Delete or Insert operation, oracle tries to acquire lock on that row. Only when the process has acquired lock the process can modify the row otherwise the process waits for the lock. This wait situation triggers this event. The lock is released whenever a COMMIT is issued by the process which has acquired lock for the row. Once the lock is released, processes waiting on this event can acquire lock on the row and perform DML operation

20. direct Path writes: You wont see them unless you are doing some appends or data loads. The session has issued asynchronous I/O requests that bypass the buffer cache and is waiting for them to complete. These wait events often involve temporary segments, sorting activity, parallel query or hash joins.


21. direct Path reads / direct path writes: Could happen if you are doing a lot of parallel query activity. The session has issued asynchronous I/O requests that bypass the buffer cache and is waiting for them to complete. These wait events often involve temporary segments, sorting activity, parallel query or hash joins. Usually sorting to Temp. Can also be parallel query. Could also be insert append, etc Adjust PGA_AGGREGATE_TARGET to fix it.

22. write complete waits: The session is waiting for a requested buffer to be written to disk; the buffer cannot be used while it is being written.


23. direct path read temp or direct path write temp: This wait event shows Temp file activity (sort,hashes,temp tables, bitmap) check pga parameter or sort area or hash area parameters. You might want to increase them


24. Undo segment extension: The session is waiting for an undo segment to be extended or shrunk. If excessive, tune undo


25. wait for a undo record: Usually only during recovery of large transactions, look at turning off parallel undo recovery.


26. Control File Parallel Write: The session has issued multiple I/O requests in parallel to write blocks to all control files, and is waiting for all of the writes to complete.


27. Control File Sequential Read: The session is waiting for blocks to be read from a control file.


28. DB File Parallel Write: The process, typically DBWR, has issued multiple I/O requests in parallel to write dirty blocks from the buffer cache to disk and is waiting for all requests to complete.


29. Library Cache load lock: The session is waiting for the opportunity to load an object or a piece of an object into the library cache. (Only one process can load an object or a piece of an object at a time.)


30. log file sequential read: The session is waiting for blocks to be read from the online redo log into memory. This primarily occurs at instance startup and when the ARCH process archives filled online redo logs.


Time Model Statistics
Oracle Database time model related statistics are presented next. The time model allows you to see a summary of where the database is spending it's time. The report will present the various time related statistic (such as DB CPU) and how much total time was spent in the mode of operation represented by that statistic. Here is an example of the time model statistic report:

  • Total time in database user-calls (DB Time): 20586.1s
  • Statistics including the word "background" measure background process time, and so do not contribute to the DB time statistic
  • Ordered by % or DB time desc, Statistic name
Statistic NameTime (s)% of DB Time
sql execute elapsed time19,640.8795.41
DB CPU17,767.2086.31
parse time elapsed73.750.36
hard parse elapsed time38.350.19
PL/SQL execution elapsed time32.040.16
hard parse (sharing criteria) elapsed time6.980.03
connection management call elapsed time4.250.02
repeated bind elapsed time3.430.02
PL/SQL compilation elapsed time3.040.01
hard parse (bind mismatch) elapsed time1.620.01
sequence load elapsed time0.740.00
failed parse elapsed time0.040.00
DB time20,586.08 
background elapsed time859.22 
background cpu time68.05

If parsing time is very high, or if hard parsing is significant, you must investigate it further. You should not expect the % of DB Time to add up to 100% because there is overlap among statistics.
Generally you want SQL processing time high, parsing and other stuff low. Time related statistics presents the various operations which are consuming most of the database time.
If SQL time>>DB CPU time then probably have IO issues.
If Hard parses or parsing time is very high then further investigation should be done to resolve the problem. .

Example
Statistic Name
Time (s)
% of DB Time
sql execute elapsed time
12,416.14
86.45
DB CPU
9,223.70
64.22
parse time elapsed
935.61
6.51
hard parse elapsed time
884.73
6.16
failed parse elapsed time
821.39
5.72
PL/SQL execution elapsed time
153.51
1.07
hard parse (sharing criteria) elapsed time
25.96
0.18
connection management call elapsed time
14.00
0.10
hard parse (bind mismatch) elapsed time
4.74
0.03
PL/SQL compilation elapsed time
1.20
0.01
repeated bind elapsed time
0.22
0.00
sequence load elapsed time
0.11
0.00
DB time
14,362.96

background elapsed time
731.00

background cpu time
72.00


In the above example, 9,223.70 seconds CPU time was used for all user sessions. This was just under 65% of database resources.
In total there was 14363 seconds database time used.
The total wait event time can be calculated as 14363 – 9223.70 = 5139.3 seconds. The lion share of database time (86.45%) was spent on executing sql which is a good sign. The total parse time was 935.61 seconds of which 884.73 seconds was hard parsing. The rest of statistics is tiny in this case

Operating System Statistics

This part of the report provides some basic insight into OS performance, and OS configuration too. This report may vary depending on the OS platform that your database is running on. Here is an example from a Linux system:
  • *TIME statistic values are diffed. All others display actual values. End Value is displayed if different
  • ordered by statistic type (CPU Use, Virtual Memory, Hardware Config), Name
StatisticValueEnd Value
BUSY_TIME1,831,850 
IDLE_TIME26,901,106 
IOWAIT_TIME226,948 
NICE_TIME8 
SYS_TIME212,021 
USER_TIME1,596,003 
LOAD11
RSRC_MGR_CPU_WAIT_TIME0 
VM_IN_BYTES1,560,961,024 
VM_OUT_BYTES475,336,945,664 
PHYSICAL_MEMORY_BYTES12,582,432,768 
NUM_CPUS16 
NUM_CPU_CORES8 
NUM_CPU_SOCKETS2 
GLOBAL_RECEIVE_SIZE_MAX4,194,304 
GLOBAL_SEND_SIZE_MAX1,048,576 
TCP_RECEIVE_SIZE_DEFAULT87,380 
TCP_RECEIVE_SIZE_MAX174,760 
TCP_RECEIVE_SIZE_MIN4,096 
TCP_SEND_SIZE_DEFAULT16,384 
TCP_SEND_SIZE_MAX131,072 
TCP_SEND_SIZE_MIN4,096 

In this example output, for example, we have 16 CPU's on the box.

Operating System Statistics - Detail
Snap TimeLoad%busy%user%sys%idle%iowait
12-Jul 13:00:590.99     
12-Jul 14:00:032.676.475.630.7793.530.56
12-Jul 15:00:082.4511.6710.221.3088.331.47
12-Jul 16:00:122.8811.9310.431.3588.071.45
12-Jul 17:00:160.741.611.370.2198.390.46
12-Jul 18:00:210.800.190.130.0699.810.01



Foreground Wait Class and Foreground Wait Events   
Closely associated with the time model section of the report are the Foreground wait class and Foreground wait event statistics sections.
Within Oracle, the duration of a large number of operations  (e.g. Writing to disk or to the control file) is metered. These are known as wait events, because each of these operations requires the system to wait for the event to complete.
Thus, the execution of some database operation (e.g. a SQL query) will have a number of wait events associated with it. We can try to determine which wait events are causing us problems by looking at the wait classes and the wait event reports generated from AWR.
Wait classes define "buckets" that allow for summation of various wait times. Each wait event is assigned to one of these buckets (for example System I/O or User I/O). These buckets allow one to quickly determine which subsystem is likely suspect in performance problems  (e.g. the network, or the cluster).

Foreground Wait Class
  • s - second, ms - millisecond - 1000th of a second
  • ordered by wait time desc, waits desc
  • %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
  • Captured Time accounts for 107.5% of Total DB time 20,586.08 (s)
  • Total FG Wait Time: 4,367.43 (s) DB CPU time: 17,767.20 (s)
Wait ClassWaits%Time -outsTotal Wait Time (s)Avg wait (ms)%DB time
DB CPU  17,767 86.31
User I/O6,536,57603,500117.00
Commit169,635066643.24
Other350,0802114000.68
Concurrency78,00205810.28
Network1,755,5470200.01
Application5790120.00
System I/O5840000.00
Configuration10000.00


Here is an example of the wait class report section:
          -------------------------------------------------------------
Foreground Wait Class                               DB/Inst: A109/a1092  Snaps: 2009-2010
-> s  - second
-> cs - centisecond -     100th of a second
-> ms - millisecond -    1000th of a second
-> us - microsecond - 1000000th of a second
-> ordered by wait time desc, waits desc
                                                                  Avg
                                       %Time       Total Wait    wait     Waits
Wait Class                      Waits  -outs         Time (s)    (ms)      /txn
-------------------- ---------------- ------ ---------------- ------- ---------
System I/O                      8,142     .0               25       3      10.9
Other                         439,596   99.6                3       0     589.3
User I/O                          112     .0                0       3       0.2
Cluster                           443     .0                0       0       0.6
Concurrency                       216     .0                0       0       0.3
Commit                             16     .0                0       2       0.0
Network                         3,526     .0                0       0       4.7
Application                        13     .0                0       0       0.0
          -------------------------------------------------------------

In this report the system I/O wait class has the largest number of waits (total of 25 seconds) and an average wait of 3 milliseconds. 



Foreground Wait EventsWait events are normal occurrences, but if a particular sub-system is having a problem performing (e.g. the disk sub-system) this fact will appear in the form of one or more wait events with an excessive duration.
The wait event report then provides some insight into the detailed wait events. Here is an example of the wait event report (we have eliminated some of the bulk of this report, because it can get quite long). Note that this section is sorted by wait time (listed in microseconds).
  • s - second, ms - millisecond - 1000th of a second
  • Only events with Total Wait Time (s) >= .001 are shown
  • ordered by wait time desc, waits desc (idle events last)
  • %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
EventWaits%Time -outsTotal Wait Time (s)Avg wait (ms)Waits /txn% DB time
direct path write temp1,837,85402,267110.5311.01
direct path read2,838,1900930016.264.52
log file sync169,635066640.973.24
db file sequential read13,2220143110.080.69
direct path read temp1,837,0070131010.530.64
PX Deq: Slave Session Stats131,555010710.750.52
db file scattered read8,44802630.050.13
kksfbc child completion44110022510.000.11
latch: shared pool4,84901630.030.08
library cache: mutex X67,70301400.390.07
library cache lock346012350.000.06
cursor: pin S wait on X58209160.000.05
latch free9,6470710.060.03
os thread startup11604320.000.02
SQL*Net message to client1,739,1320209.970.01
cursor: mutex S1,6660210.010.01
latch: row cache objects1,6580110.010.01
read by other session9201120.000.01
db file parallel read3440130.000.00
PX Deq: Signal ACK EXT65,7870100.380.00
PX Deq: Signal ACK RSG65,7870100.380.00
enq: PS - contention7580110.000.00
enq: RO - fast object reuse4001130.000.00
Disk file operations I/O1,3860000.010.00
enq: KO - fast object checkpoint5390010.000.00
PX qref latch964100000.010.00
latch: parallel query alloc buffer8360000.000.00
latch: cache buffers chains1740010.000.00
SQL*Net more data to client16,4150000.090.00
enq: TX - index contention500370.000.00
library cache load lock1001390.000.00
asynch descriptor resize71,974100000.410.00
PX Deq: Table Q Get Keys4860000.000.00
reliable message5770000.000.00
buffer busy waits6760000.000.00
cursor: pin S1890000.000.00
row cache lock170020.000.00
direct path sync150020.000.00
latch: cache buffer handles100290.000.00
utl_file I/O180010.000.00
PX Deq: Table Q qref1,1600000.010.00
wait list latch free130010.000.00
latch: object queue header operation320000.000.00
control file sequential read5840000.000.00
SQL*Net message from client1,739,1060260,9041509.97 
jobq slave wait41,89210020,9645000.24 
PX Deq: Execution Msg746,68701,61224.28 
PX Deq: Table Q Normal1,057,627038706.06 
PX Deq Credit: send blkd128,373026620.74 
PX Deq: Execute Reply710,73505104.07 
PX Deq: Parse Reply65,79001300.38 
PX Deq: Join ACK65,7900400.38 
PX Deq Credit: need buffer1,7830310.01 
PX Deq: Table Q Sample1,2750100.01 

Example
Foreground Wait Events 
                                                                   Avg
                                             %Time  Total Wait    wait     Waits
Event                                 Waits  -outs    Time (s)    (ms)      /txn
---------------------------- -------------- ------ ----------- ------- ---------
control file parallel write           1,220     .0          18      15       1.6
control file sequential read          6,508     .0           6       1       8.7
CGS wait for IPC msg                422,253  100.0           1       0     566.0
change tracking file synchro             60     .0           1      13       0.1
db file parallel write                  291     .0           0       1       0.4
db file sequential read                  90     .0           0       4       0.1
reliable message                        136     .0           0       1       0.2
log file parallel write                 106     .0           0       2       0.1
lms flush message acks                    1     .0           0      60       0.0
gc current block 2-way                  200     .0           0       0       0.3
change tracking file synchro             59     .0           0       1       0.1

In this example our control file parallel write waits (which occurs during writes to the control file) are taking up 18 seconds total, with an average wait of 15 milliseconds per wait.
Additionally we can see that we have 1.6 waits per transaction (or 15ms * 1.6 per transaction = 24ms). 

Background Wait Events

Background wait events are those not associated with a client process. They indicate waits encountered by system and non-system processes. Examples of background system processes are LGWR and DBWR.  An example of a non-system background process would be a parallel query slave.  Note that it is possible for a wait event to appear in both the foreground and background wait events statistics, for examples the enqueue and latch free events.  The idle wait events appear at the bottom of both sections and can generally safely be ignored. Typically these type of events keep record of the time while the client is connected to the database but not requests are being made to the server. Usually not a big contributor.
  • ordered by wait time desc, waits desc (idle events last)
  • Only events with Total Wait Time (s) >= .001 are shown
  • %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
EventWaits%Time -outsTotal Wait Time (s)Avg wait (ms)Waits /txn% bg time
log file parallel write189,549061531.0971.53
db file async I/O submit28,33403710.164.27
os thread startup711025350.002.88
control file parallel write32,03001610.181.88
db file sequential read899014150.011.57
latch: shared pool7,1110910.041.09
latch: call allocation15,5370910.091.07
latch free8,2640510.050.63
ARCH wait on ATTACH25903110.000.34
Log archive I/O7260230.000.24
row cache lock2017460.000.17
control file sequential read83,3030100.480.12
db file parallel read3001170.000.06
Disk file operations I/O1,2140000.010.05
log file sequential read8380000.000.05
direct path sync500310.000.02
ADR block file read800020.000.02
log file sync1100110.000.01
enq: PR - contention300230.000.01
latch: cache buffers chains100460.000.01
db file single write2640000.000.00
latch: parallel query alloc buffer630010.000.00
LGWR wait for redo copy5210000.000.00
Data file init write200010.000.00
latch: row cache objects100150.000.00
latch: session allocation270010.000.00
db file scattered read30040.000.00
reliable message500000.000.00
direct path write140010.000.00
asynch descriptor resize1,442100000.010.00
wait list latch free100010.000.00
rdbms ipc reply570000.000.00
log file single write400000.000.00
ADR block file write250000.000.00
ADR file lock300000.000.00
library cache: mutex X20010.000.00
SQL*Net message to client5870000.000.00
rdbms ipc message323,54038356,76011031.85 
PX Idle Wait65,8850115,16517480.38 
DIAG idle wait35,86310035,90010010.21 
Space Manager: slave idle wait5,6269727,71049250.03 
pmon timer5,98410017,95930010.03 
Streams AQ: qmn slave idle wait642017,953279640.00 
Streams AQ: qmn coordinator idle wait1,2825017,953140040.01 
shared server idle wait59810017,946300100.00 
dispatcher timer29910017,942600070.00 
smon timer1133317,7191568080.00 
SQL*Net message from client7950110.00 
class slave wait830000.00 


Service Statistics
A service is a grouping of processes. Users may be grouped in SYS$USER. Application logins (single user) may be grouped with that user name
  • ordered by DB Time
Service NameDB Time (s)DB CPU (s)Physical Reads (K)Logical Reads (K)
FGUARD.fiservipo.com19,90317,555413,742386,056
SYS$USERS6832121,7336,954
FGUARDXDB0000
SYS$BACKGROUND003134





SQL Information Section
Next in the report we find several different reports that present SQL statements that might be improved by tuning. Any SQL statement appears in the top 5 statements in two or more areas below, then it is a prime candidate for tuning. The sections are:
  • SQL Ordered by Elapsed Time - IO waits
  • SQL Ordered by CPU Time - Sorting, hashing
  • SQL Ordered by Buffer Gets - High logical IO
  • SQL Ordered by Disk Reads - High physical IO
  • SQL Ordered by Executions - May indicate loop issues
  • SQL Ordered by Parse Calls - Memory issues
  • SQL Ordered by Sharable Memory - Informational
  • SQL Ordered by Version Count - May indicate unsafe bind variables
  • SQL Ordered by Cluster Wait Time - Indicates physical issues (RPB, block size)
Let try to see what these mean.
SQL Ordered by Elapsed Time
Total Elapsed Time = CPU Time + Wait Time. If a SQL statement appears in the total elapsed time area of the report this means its CPU time plus any other wait times made it pop to the top of the pile. Excessive Elapsed Time could be due to excessive CPU usage or excessive wait times.
This is the area that you need to examine and probably the one that will be reported by the users or application support. From a consumer perspective, the finer details don’t matter. The application is slow. Full stop.
In conjunction with excessive Elapsed time check to see if this piece of SQL is also a high consumer under Total CPU Time. It is normally the case. Otherwise check the wait times and Total Disk Reads. They can either indicate issues with wait times (slow disks, latch gets etc) or too much Physical IO associated with tables scans or sub-optimal indexes.  This section is a gate opener and often you will need to examine other sections.

SQL Ordered by CPU Time
When a statement appears in the Total CPU Time area this indicates it used excessive CPU cycles during its processing. Excessive CPU processing time can be caused by sorting, excessive function usage or long parse times. Indicators that you should be looking at this section for SQL tuning candidates include high CPU percentages in the service section for the service associated with this SQL (a hint, if the SQL is uppercase it probably comes from a user or application; if it is lowercase it usually comes from the internal or background processes). To reduce total CPU time, reduce sorting by using composite indexes that can cover sorting and use bind variables to reduce parse times.

SQL Ordered by Buffer Gets
Total buffer gets mean a SQL statement is reading a lot of data from the db block buffers. Generally speaking buffer gets (AKA logical IO or LIO) are OK, except when they become excessive. The old saying that you reduce the logical IO, because then the physical IO (disk read) will take care of itself holds true. LIO may  have incurred a PIO in order to get the block into the buffer in the first place. Reducing buffer gets is very important and should not be underestimated. To get a block from db block buffers, we have to latch it (i.e. in order to prevent someone from modifying the data structures we are currently reading from the buffer). Although latches are less persistent than locks, a latch is still a serialization device. Serialization devices inhibit scalability, the more you use them, the less concurrency you get. Therefore in most cases optimal buffer gets can result in improved performance. Also note that by lowering buffer gets you will require less CPU usage and less latching. |Thus to reduce excessive buffer gets, optimize SQL to use appropriate indexes and reduce full table scans. You can also look at improving the indexing strategy and consider deploying partitioning (licensed).

SQL Ordered by Disk Reads
High total disk reads mean a SQL statement is reading a lot of data from disks rather than being able to access that data from the db block buffers. High physical reads after a server reboot are expected as the cache is cold and data is fetched from the disk. However, disk reads (or physical reads) are undesirable in an OLTP system, especially when they become excessive. Excessive disk reads do cause performance issues. The usual norm is to increase the db buffer cache to allow more buffers and reduce ageing . Total disk reads are typified by high physical reads, a low buffer cache hit ratio, with high IO wait times. Higher wait times for Disk IO can be associated with a variety of reasons (busy or over saturated SAN, slower underlying storage, low capacity in HBC and other hardware causes). Statistics on IO section in AWR, plus the Operating System diagnostic tools as simple as iostatcan help in identifying these issues. To reduce excessive disk reads, consider partitioning, use indexes and look at optimizing SQL to avoid excessive full table scans.

SQL Ordered by Executions
High total executions need to be reviewed to see if they are genuine executions or loops in SQL code. I have also seen situations where autosys jobs fire duplicate codes erroneously. In general statements with high numbers of executions usually are being properly reused. However, there is always a chance of unnecessary loop in PL/SQL, Java or C#. Statements with high number of executions, high number of logical and or physical reads are candidates for review to be sure they are not being executed multiple times when a single execution would serve. If the database has excessive physical and logical reads or excessive IO wait times, then look at the SQL statements that show excessive executions and show high physical and logical reads.

Parse Calls
Whenever a statement is issued by a user or process, regardless of whether it is in the SQL pool it undergoes a parse.  As explained under Parsing, the parse can be a hard parse or a soft parse. Excessive parse calls usually go with excessive executions. If the statement is using what are known as unsafe bind variables then the statement will be reparsed each time. If the header parse ratios are low look here and in the version count areas.

SQL Ordered by Memory
Sharable Memory refers to Shared Pool memory area in SGA , hence this particular section in AWR Report states about the SQL STATEMENT CURSORS which consumed the maximum amount of the Shared Pool for their execution.
In general high values for Sharable Memory doesn’t necessary imply there is an issue It simply means that:
    - These SQL statements are big or complex and Oracle has to keep lots of information about these statements OR
    - big number of child cursors exist for those parent cursors
    - combination of 1 & 2
In case of point 2, it may be due to poor coding such as bind variables mismatch, security mismatch  or overly large SQL statements that join many tables. In a DSS or  DW environment large complex statements are normal. In an OLTP database large or complex statements are usually the result of over-normalization of the database design, attempts to use an OLTP system as a DW or simply poor coding techniques. Usually large statements will result in excessive parsing, recursion, and large CPU usage.

SQL Ordered by Version Count
High version counts are usually due to multiple identical-schema databases, unsafe bind variables, or Oracle bugs.

The SQL that is stored in the shared pool SQL area (Library cache) is reported in this section in different ways:
. SQL ordered by Buffer Gets
. SQL ordered by Physical Reads
. SQL ordered by Executions
. SQL ordered by Parse Calls
- SQL ordered by Gets:
This section reports the contents of the SQL area ordered by the number of buffer gets and can be used to identify the most CPU Heavy SQL.
- Many DBAs feel that if the data is already contained within the buffer cache the query should be efficient.  This could not be further from the truth.  Retrieving more data than needed, even from the buffer cache, requires CPU cycles and interprocess IO. Generally speaking, the cost of physical I/O is not 10,000 times more expensive.  It actually is in the neighborhood of 67 times and actually almost zero if the data is stored in the UNIX buffer cache.
- The statements of interest are those with a large number of gets per execution especially if the number of executions is high.
- High buffer gets generally correlates with heavy CPU usage

- SQL ordered by Reads:
This section reports the contents of the SQL area ordered by the number of reads from the data files and can be used to identify SQL causing IO bottlenecks which consume the following resources.
- CPU time needed to fetch unnecessary data.
- File IO resources to fetch unnecessary data.
- Buffer resources to hold unnecessary data.
- Additional CPU time to process the query once the data is retrieved into the buffer.

- SQL ordered by Executions:
This section reports the contents of the SQL area ordered by the number of query executions. It is primarily useful in identifying the most frequently used SQL within the database so that they can be monitored for efficiency.  Generally speaking, a small performance increase on a frequently used query provides greater gains than a moderate performance increase on an infrequently used query. Possible reasons for high Reads per Exec are use of unselective indexes require large numbers of blocks to be fetched where such blocks are not cached well in the buffer cache, index fragmentation, large Clustering Factor in index etc.

- SQL ordered by Parse Calls:
This section shows the number of times a statement was parsed as compared to the number of times it was executed.  One to one parse/executions may indicate that:
- Bind variables are not being used.
  The shared pool may be too small and the parse is not being retained long enough for multiple executions.
- cursor_sharing is set to exact (this should NOT be changed without considerable testing on the part of the client).


Generate Execution Plan for given SQL statement
If you have identified one or more problematic SQL statement, you may want to check the execution plan. Remember the "Old Hash Value" from the report above (1279400914), then execute the scrip to generate the execution plan.
sqlplus perfstat/perfstat
SQL> @?/rdbms/admin/sprepsql.sqlEnter the Hash Value, in this example: 1279400914
SQL Text
~~~~~~~~
create table test as select * from all_objects

Known Optimizer Plan(s) for this Old Hash Value
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows all known Optimizer Plans for this database instance, and the Snap Id's
they were first found in the shared pool.  A Plan Hash Value will appear
multiple times if the cost has changed
-> ordered by Snap Id

  First        First          Plan
 Snap Id     Snap Time     Hash Value        Cost
--------- --------------- ------------ ----------
        6 14 Nov 04 11:26   1386862634        52

Plans in shared pool between Begin and End Snap Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows the Execution Plans found in the shared pool between the begin and end
snapshots specified.  The values for Rows, Bytes and Cost shown below are those
which existed at the time the first-ever snapshot captured this plan - these
values often change over time, and so may not be indicative of current values
-> Rows indicates Cardinality, PHV is Plan Hash Value
-> ordered by Plan Hash Value

--------------------------------------------------------------------------------
| Operation                      | PHV/Object Name     |  Rows | Bytes|   Cost |
--------------------------------------------------------------------------------
|CREATE TABLE STATEMENT          |----- 1386862634 ----|       |      |     52 |
|LOAD AS SELECT                  |                     |       |      |        |
| VIEW                           |                     |     1K|  216K|     44 |
|  FILTER                        |                     |       |      |        |
|   HASH JOIN                    |                     |     1K|  151K|     38 |
|    TABLE ACCESS FULL           |USER$                |    29 |  464 |      2 |
|    TABLE ACCESS FULL           |OBJ$                 |     3K|  249K|     35 |
|   TABLE ACCESS BY INDEX ROWID  |IND$                 |     1 |    7 |      2 |
|    INDEX UNIQUE SCAN           |I_IND1               |     1 |      |      1 |
|   NESTED LOOPS                 |                     |     5 |  115 |     16 |
|    INDEX RANGE SCAN            |I_OBJAUTH1           |     1 |   10 |      2 |
|    FIXED TABLE FULL            |X$KZSRO              |     5 |   65 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   FIXED TABLE FULL             |X$KZSPR              |     1 |   26 |     14 |
|   VIEW                         |                     |     1 |   13 |      2 |
|    FAST DUAL                   |                     |     1 |      |      2 |
--------------------------------------------------------------------------------


Instance Activity Stats Section


This section provides us with a number of various statistics (such as, how many DBWR Checkpoints occurred, or how many consistent gets occurred during the snapshot). These are the statistics that the summary information is derived from. A list of the statistics maintained by the RDBMS kernel can be found in Appendix C of the Oracle Reference manual for the version being utilized.
Here is a partial example of the report:
Instance Activity Stats for DB: PHS2  Instance: phs2  Snaps: 100 -104
Statistic                                    Total   per Second    per Trans
--------------------------------- ---------------- ------------ ------------
CPU used by this session                    84,161         23.4      3,825.5
CPU used when call started                 196,346         54.5      8,924.8
CR blocks created                              709          0.2         32.2
DBWR buffers scanned                             0          0.0          0.0
DBWR checkpoint buffers written                245          0.1         11.1
DBWR checkpoints                                33          0.0          1.5
DBWR cross instance writes                      93          0.0          4.2
DBWR free buffers found                          0          0.0          0.0
....
....
branch node splits                             7,162            0.1        0.0

consistent gets                       12,931,850,777      152,858.8    3,969.5
current blocks converted for CR               75,709            0.9        0.0
db block changes                         343,632,442        4,061.9      105.5
db block gets                            390,323,754        4,613.8      119.8
hot buffers moved to head of LRU         197,262,394        2,331.7       60.6
leaf node 90-10 splits                        26,429            0.3        0.0
leaf node splits                             840,436            9.9        0.3
logons cumulative                             21,369            0.3        0.0
physical reads                           504,643,275        5,965.1      154.9
physical writes                           49,724,268          587.8       15.3
session logical reads                 13,322,170,917      157,472.5    4,089.4
sorts (disk)                                   4,132            0.1        0.0
sorts (memory)                             7,938,085           93.8        2.4
sorts (rows)                             906,207,041       10,711.7      278.2
table fetch continued row                 25,506,365          301.5        7.8
table scans (long tables)                        111            0.0        0.0
table scans (short tables)                 1,543,085           18.2        0.5

Instance Activity Terminology
Session Logical Reads = All reads cached in memory.  Includes both consistent gets and also the db block gets.
Consistent Gets = These are the reads of a block that are in the cache.  They are NOT to be confused with consistent read (cr) version of a block in the buffer cache (usually the current version is read).
Db block gets = These are block gotten to be changed.  MUST be the CURRENT block and not a cr block.
Db block changes = These are the db block gets (above) that were actually changed.
Physical Reads = Blocks not read from the cache.  Either from disk, disk cache or O/S cache; there are also physical reads direct which bypass cache using Parallel Query (not in hit ratios).

Of particular interest are the following statistics.
- CPU USED BY THIS SESSION, PARSE TIME CPU or RECURSIVE CPU USAGE:  These numbers are useful to diagnose CPU saturation on the system (usually a query tuning issue). The formula to calculate the CPU usage breakdown is:
Service (CPU) Time = other CPU + parse time CPU
Other CPU = "CPU used by this session" - parse time CPU
Some releases do not correctly store this data and can show huge numbers. 
recursive cpu usage =  This component can be high if large amounts of PL/SQL are being processed. It is outside the scope of this document to go into detail with this, but you will need to identify your complete set of PL/SQL, including stored procedures, finding the ones with the highest CPU load and optimize these. If most work done in PL/SQL is procedural processing (rather than executing SQL), a high recursive cpu usage can actually indicate a potential tuning effort.
parse time cpu= Parsing SQL statements is a heavy operation, that should be avoided by reusing SQL statements as much as possible. In precompiler programs, unnecessary parting of implicit SQL statements can be avoided by increasing the cursor cache (MAXOPENCURSORS parameter) and by reusing cursors. In programs using Oracle Call Interface, you need to write the code, so that it re-executes (in stead of reparse) cursors with frequently executed SQL statements. The v$sql view contains PARSE_CALLS and EXECUTIONS columns, that can be used to identify SQL, that is parsed often or is only executed once per parse.
other cpu= The source of other cpu is primarily handling of buffers in the buffer cache. It can generally be assumed, that the CPU time spent by a SQL statement is approximately proportional to the number of buffer gets for that SQL statements, hence, you should identify and sort SQL statements by buffer gets in v$sql. In your report, look at the part ‘SQL ordered by Gets for DB’. Start tuning SQL statements from the top of this list. In Oracle, the v$sql view contain a column, CPU_TIME, which directly shows the cpu time associated with executing the SQL statement.
- DBWR BUFFERS SCANNED:  the number of buffers looked at when scanning the lru portion of the buffer cache for dirty buffers to make clean. Divide by "dbwr lru scans" to find the average number of buffers scanned. This count includes both dirty and clean buffers. The average buffers scanned may be different from the average scan depth due to write batches filling up before a scan is complete. Note that this includes scans for reasons other than make free buffer requests.
- DBWR CHECKPOINTS: the number of checkpoints messages that were sent to DBWR and not necessarily the total number of actual checkpoints that took place.  During a checkpoint there is a slight decrease in performance since data blocks are being written to disk and that causes I/O. If the number of checkpoints is reduced, the performance of normal database operations improve but recovery after instance failure is slower.
- DBWR TIMEOUTS: the number of timeouts when DBWR had been idle since the last timeout.  These are the times that DBWR looked for buffers to idle write.
- DIRTY BUFFERS INSPECTED: the number of times a foreground encountered a dirty buffer which had aged out through the lru queue, when foreground is looking for a buffer to reuse. This should be zero if DBWR is keeping up with foregrounds.
- FREE BUFFER INSPECTED: the number of buffers skipped over from the end of the LRU queue in order to find a free buffer.  The difference between this and "dirty buffers inspected" is the number of buffers that could not be used because they were busy or needed to be written after rapid aging out. They may have a user, a waiter, or being read/written.
- RECURSIVE CALLS:  Recursive calls occur because of cache misses and segment extension. In general if recursive calls is greater than 30 per process, the data dictionary cache should be optimized and segments should be rebuilt with storage clauses that have few large extents.  Segments include tables, indexes, rollback segment, and temporary segments.
NOTE: PL/SQL can generate extra recursive calls which may be unavoidable.
- REDO BUFFER ALLOCATION RETRIES: total number of retries necessary to allocate space in the redo buffer.  Retries are needed because either the redo writer has gotten behind, or because an event  (such as log switch) is occurring
- REDO LOG SPACE REQUESTS:  indicates how many times a user process waited for space in the redo log buffer.  Try increasing the init.ora parameter LOG_BUFFER so that zero Redo Log Space Requests are made.
- REDO WASTAGE: Number of bytes "wasted" because redo blocks needed to be written before they are completely full.   Early writing may be needed to commit transactions, to be able to write a database buffer, or to switch logs
- SUMMED DIRTY QUEUE LENGTH: the sum of the lruw queue length after every write request completes. (divide by write requests to get average queue length after write completion)
- TABLE FETCH BY ROWID: the number of rows that were accessed by a rowid.  This includes rows that were accessed using an index and rows that were accessed using the statement where rowid = 'xxxxxxxx.xxxx.xxxx'.
- TABLE FETCH BY CONTINUED ROW: indicates the number of rows that are chained to another block. In some cases (i.e. tables with long columns) this is unavoidable, but the ANALYZE table command should be used to further investigate the chaining, and where possible, should be eliminated by rebuilding the table.
- Table Scans (long tables) is the total number of full table scans performed on tables with more than 5 database blocks.  If the number of full table scans is high the application should be tuned to effectively use Oracle indexes. Indexes, if they exist, should be used on long tables if less than 10-20% (depending on parameter settings and CPU count) of the rows from the table are returned. If this is not the case, check the db_file_multiblock_read_count parameter setting. It may be too high.  You may also need to tweak optimizer_index_caching and optimizer_index_cost_adj.
- Table Scans (short tables) is the number of full table scans performed on tables with less than 5 database blocks.  It is optimal to perform full table scans on short tables rather than using indexes.



I/O Stats Section

The IO Stats stats report provides information on tablespace IO performance. From this report you can determine if the tablespace or datafiles are suffering from sub-standard performance in terms of IO response from the disk sub-system.
IO Activity Input/Output (IO) statistics for the instance are listed in the following sections/formats:
- Tablespace I/O Stats for DB: Ordered by total IO per tablespace.
- File I/O Stats for DB: Ordered alphabetically by tablespace, filename.
If the statistic "Buffer Waits" for a tablespace is greater than 1000, you may want to consider tablespace reorganization in order to spread tables within it across another tablespaces.
Note that Oracle considers average read times of greater than 20 ms unacceptable.  If a datafile consistently has average read times of 20 ms or greater then:
- The queries against the contents of the owning tablespace should be examined and tuned so that less data is retrieved.
- If the tablespace contains indexes, another option is to compress the indexes so that they require less space and hence, less IO.
- The contents of that datafile should be redistributed across several disks/logical volumes to more easily accommodate the load.
- If the disk layout seems optimal, check the disk controller layout.  It may be that the datafiles need to be distributed across more disk sets.
Tablespace IO Stats
  • ordered by IOs (Reads + Writes) desc
TablespaceReadsAv Reads/sAv Rd(ms)Av Blks/RdWritesAv Writes/sBuffer WaitsAv Buf Wt(ms)
TEMPFG1,839,3831020.0031.001,837,948102741.62
FG_DATA2,791,6471550.01125.859,6181120.00
FG_DATA_ARCH48,17430.14127.341000.00
FG_INDX16,19413.5160.394,6470230.00
SYSAUX1,331029.001.027,86701843.33
SYSTEM4,49108.381.302,15402780.97
UNDOTBS1000.000.004,45003810.03

If the tablespace IO report seems to indicate a tablespace has IO problems, we can then use the file IO stat report allows us to drill into the datafiles of the tablespace in question and determine what the problem might be.


File IO Stats
  • ordered by Tablespace, File
TablespaceFilenameReadsAv Reads/sAv Rd(ms)Av Blks/RdWritesAv Writes/sBuffer WaitsAv Buf Wt(ms)
FG_DATA/oradata/FGUARD/fg_data01.dbf332,276180.02125.951,537050.00
FG_DATA/oradata/FGUARD/fg_data02.dbf332,928190.02125.87575000.00
FG_DATA/oradata/FGUARD/fg_data03.dbf524,409290.01126.722,145000.00
FG_DATA/oradata/FGUARD/fg_data04.dbf421,718230.02124.68995010.00
FG_DATA/oradata/FGUARD/fg_data05.dbf323,349180.02124.58709000.00
FG_DATA/oradata/FGUARD/fg_data06.dbf332,548190.02125.681,338000.00
FG_DATA/oradata/FGUARD/fg_data07.dbf331,332180.01126.071,027030.00
FG_DATA/oradata/FGUARD/fg_data08.dbf193,087110.00127.851,292030.00
FG_DATA_ARCH/oradata/FGUARD/fg_data_arch01.dbf1,99300.55126.710000.00
FG_DATA_ARCH/oradata/FGUARD/fg_data_arch02.dbf15,77210.19127.351000.00
FG_DATA_ARCH/oradata/FGUARD/fg_data_arch03.dbf16,16310.09127.370000.00
FG_DATA_ARCH/oradata/FGUARD/fg_data_arch04.dbf14,24610.10127.370000.00
FG_INDX/oradata/FGUARD/fg_indx01.dbf2,90803.8439.20358010.00
FG_INDX/oradata/FGUARD/fg_indx02.dbf1,204010.9771.131,130050.00
FG_INDX/oradata/FGUARD/fg_indx03.dbf7,58800.9362.001,132060.00
FG_INDX/oradata/FGUARD/fg_indx04.dbf1,73305.7964.18829020.00
FG_INDX/oradata/FGUARD/fg_indx05.dbf1,71407.0665.41927030.00
FG_INDX/oradata/FGUARD/fg_indx06.dbf1,04703.0780.76271060.00
SYSAUX/oradata/FGUARD/sysaux01.dbf382030.631.055,087080.00
SYSAUX/oradata/FGUARD/sysaux02.dbf949028.351.002,78001078.00
SYSTEM/oradata/FGUARD/system01.dbf4,46508.321.302,00102690.93
SYSTEM/oradata/FGUARD/system02.dbf26019.231.00153092.22
TEMPFG/oradata/FGUARD/TEMPFG01.dbf1,839,3831020.0031.001,837,948102741.62
UNDOTBS1/oradata/FGUARD/undotbs01.dbf00  4,45003810.03



Buffer Pool Statistics Section
The buffer pool statistics report follows. It provides a summary of the buffer pool configuration and usage statistics.
The buffer statistics are comprised of two sections:
- Buffer Pool Statistics:  This section can have multiple entries if multiple buffer pools are allocated. A baseline of the database's buffer pool statistics should be available to compare with the current report buffer pool statistics.  A change in that pattern unaccounted for by a change in workload should be a cause for concern. Also check the Buffer Pool Advisory to identify if increasing that parameter (db_cache_size) would help to reduce Physical Reads.
  • Standard block size Pools D: default, K: keep, R: recycle
  • Default Pools for other block sizes: 2k, 4k, 8k, 16k, 32k
PNumber of BuffersPool Hit%Buffer GetsPhysical ReadsPhysical WritesFree Buff WaitWrit Comp WaitBuffer Busy Waits
D183,3039934,022,316230,16785,44500786

- Checkpoint Activity: 

Advisory Statistics Section
In this section, we receive several recommendations on changes that we can perform and how that will affect the overall performance of the DB.

Instance Recovery Stats 
The instance recovery stats report provides information related to instance recovery. By analyzing this report, you can determine roughly how long your database would have required to perform crash recovery during the reporting period. Here is an example of this report:

  • B: Begin Snapshot, E: End Snapshot

Targt MTTR (s)Estd MTTR (s)Recovery Estd IOsActual RedoBlksTarget RedoBlksLog Sz RedoBlksLog Ckpt Timeout RedoBlksLog Ckpt Interval RedoBlksOpt Log Sz(M)Estd RAC Avail Time
B0173186404268812399532888123   
E0163068342713566999532835669   



Buffer Pool Advisory
The buffer pool advisory report answers the question, how big should you make your database buffer cache.
It provides an extrapolation of the benefit or detriment that would result if you added or removed memory from the database buffer cache. These estimates are based on the current size of the buffer cache and the number of logical and physical IO's encountered during the reporting point. This report can be very helpful in "rightsizing" your buffer cache.
Here is an example of the output of this report:

  • Only rows with estimated physical reads >0 are displayed
  • ordered by Block Size, Buffers For Estimate
PSize for Est (M)Size FactorBuffers (thousands)Est Phys Read FactorEstimated Phys Reads (thousands)Est Phys Read TimeEst %DBtime for Rds
D1440.10181.154,37811922.00
D2880.19351.104,18011388.00
D4320.29531.043,9761835.00
D5760.39711.033,9171676.00
D7200.48891.023,8861593.00
D8640.581061.013,8641534.00
D1,0080.681241.013,8501495.00
D1,1520.771421.013,8411470.00
D1,2960.871601.003,8291439.00
D1,4400.971771.003,8181409.00
D1,4881.001831.003,8151401.00
D1,5841.061951.003,8131395.00
D1,7281.162131.003,8121393.00
D1,8721.262311.003,8111390.00
D2,0161.352481.003,8101387.00
D2,1601.452661.003,8081383.00
D2,3041.552841.003,8081382.00
D2,4481.653021.003,8081382.00
D2,5921.743191.003,8081382.00
D2,7361.843371.003,8081382.00
D2,8801.943550.933,5361121.00

In this example we currently have 1.488 GB allocated to the SGA (represented by the size factor column with a value of 1.0.
It appears that if we were to reduce the memory allocated to the SGA to half of the size of the current SGA (freeing the memory to the OS for other processes) we would incur an increase of just a few more physical Reads in the process.

PGA Reports
The PGA reports provide some insight into the health of the PGA.
- The PGA Aggr Target Stats report provides information on the configuration of the PGA Aggregate Target parameter during the reporting period.
- The PGA Aggregate Target Histogram report provides information on the size of various operations (e.g. sorts). It will indicate if PGA sort operations occurred completely in memory, or if some of those operations were written out to disk.
- The PGA Memory Advisor, much like the buffer pool advisory report, provides some insight into how to properly size your PGA via the PGA_AGGREGATE_TARGET database parameter.
Here we show these reports:
PGA Aggr Target Stats
  • B: Begin Snap E: End Snap (rows dentified with B or E contain data which is absolute i.e. not diffed over the interval)
  • Auto PGA Target - actual workarea memory target
  • W/A PGA Used - amount of memory used for all Workareas (manual + auto)
  • %PGA W/A Mem - percentage of PGA memory allocated to workareas
  • %Auto W/A Mem - percentage of workarea memory controlled by Auto Mem Mgmt
  • %Man W/A Mem - percentage of workarea memory under manual control

PGA Aggr Target(M)Auto PGA Target(M)PGA Mem Alloc(M)W/A PGA Used(M)%PGA W/A Mem%Auto W/A Mem%Man W/A MemGlobal Mem Bound(K)
B1,0241,226480.560.000.000.000.00163,840
E1,0241,199422.100.620.15100.000.00163,840


PGA Aggr Target Histogram

  • Optimal Executions are purely in-memory operations
Low OptimalHigh OptimalTotal ExecsOptimal Execs1-Pass ExecsM-Pass Execs
2K4K132,478132,47800
64K128K69069000
128K256K42242200
256K512K71371300
512K1024K4,1284,12800
1M2M79679600
2M4M17217200
4M8M989800
8M16M565600
64M128M1,50701,5070


PGA Memory Advisory

  • When using Auto Memory Mgmt, minimally choose a pga_aggregate_target value where Estd PGA Overalloc Count is 0
PGA Target Est (MB)Size FactrW/A MB ProcessedEstd Extra W/A MB Read/ Written to DiskEstd PGA Cache Hit %Estd PGA Overalloc CountEstd Time
2000.13201,044.50717,452.2522.001,91257,991,729
4000.25201,044.50208,684.3749.00025,869,319
8000.50201,044.50181,379.8253.00024,145,374
1,2000.75201,044.50181,379.8253.00024,145,374
1,6001.00201,044.50181,379.8253.00024,145,374
1,9201.20201,044.500.00100.00012,693,478
2,2401.40201,044.500.00100.00012,693,478
2,5601.60201,044.500.00100.00012,693,478
2,8801.80201,044.500.00100.00012,693,478
3,2002.00201,044.500.00100.00012,693,478
4,8003.00201,044.500.00100.00012,693,478
6,4004.00201,044.500.00100.00012,693,478
9,6006.00201,044.500.00100.00012,693,478
12,8008.00201,044.500.00100.00012,693,478




Shared Pool Advisory

Use this section to evaluate your shared pool size parameter.
The shared pool advisory report provides assistance in right sizing the Oracle shared pool.
Much like the PGA Memory Advisor or the Buffer Pool advisory report, it provides some insight into what would happen should you add or remove memory from the shared pool. This can help you reclaim much needed memory if you have over allocated the shared pool, and can significantly improve performance if you have not allocated enough memory to the shared pool.

Other Advisories here
- SGA Target Advisory =  Helps for SGA_TARGET settings
- Streams Pool Advisory = Only if streams are used, if you are getting spills, indicates pool is too small
- Java Pool Advisory = Only if you are using internal Java, similar to the PL/SQL area in the library caches

Here is an example of the shared pool advisory report:

                                        Est LC Est LC  Est LC Est LC
    Shared    SP   Est LC                 Time   Time    Load   Load      Est LC
      Pool  Size     Size       Est LC   Saved  Saved    Time   Time         Mem
   Size(M) Factr      (M)      Mem Obj     (s)  Factr     (s)  Factr    Obj Hits
---------- ----- -------- ------------ ------- ------ ------- ------ -----------
       192    .4       54        3,044 #######     .8 #######  382.1  22,444,274
       240    .5       92        5,495 #######     .9 #######  223.7  22,502,102
       288    .6      139        8,122 #######     .9  53,711  102.5  22,541,782
       336    .7      186       12,988 #######    1.0  17,597   33.6  22,562,084
       384    .8      233       17,422 #######    1.0   7,368   14.1  22,569,402
       432    .9      280       23,906 #######    1.0   3,553    6.8  22,571,902
       480   1.0      327       28,605 #######    1.0     524    1.0  22,573,396
       528   1.1      374       35,282 #######    1.0       1     .0  22,574,164
       576   1.2      421       40,835 #######    1.0       1     .0  22,574,675
       624   1.3      468       46,682 #######    1.0       1     .0  22,575,055
       672   1.4      515       52,252 #######    1.0       1     .0  22,575,256
       720   1.5      562       58,181 #######    1.0       1     .0  22,575,422
       768   1.6      609       64,380 #######    1.0       1     .0  22,575,545
       816   1.7      656       69,832 #######    1.0       1     .0  22,575,620
       864   1.8      703       75,168 #######    1.0       1     .0  22,575,668
       912   1.9      750       78,993 #######    1.0       1     .0  22,575,695
       960   2.0      797       82,209 #######    1.0       1     .0  22,575,719
          -------------------------------------------------------------


SGA target advisory
The SGA target advisory report is somewhat of a summation of all the advisory reports previously presented in the AWR report. It helps you determine the impact of changing the settings of the SGA target size in terms of overall database performance. The report uses a value called DB Time as a measure of the increase or decrease in performance relative to the memory change made. Also the report will summarize an estimate of physical reads associated with the listed setting for the SGA. Here is an example of the SGA target advisory report:

SGA Target   SGA Size       Est DB     Est Physical
  Size (M)     Factor     Time (s)            Reads
---------- ---------- ------------ ----------------
       528        0.5       25,595          769,539
       792        0.8       20,053          443,095
     1,056        1.0       18,443          165,649
     1,320        1.3       18,354          150,476
     1,584        1.5       18,345          148,819
     1,848        1.8       18,345          148,819
     2,112        2.0       18,345          148,819

In this example, our SGA Target size is currently set at 1056MB. We can see from this report that if we increased the SGA target size to 2112MB, we would see almost no performance improvement (about a 98 second improvement overall). In this case, we may determine that adding so much memory to the database is not cost effective, and that the memory can be better used elsewhere.




Buffer Wait Statistics

The buffer wait statistics report helps you drill down on specific buffer wait events, and where the waits are occurring. In the following report we find that the 13 buffer busy waits we saw in the buffer pool statistics report earlier are attributed to data block waits. We might then want to pursue tuning remedies to these waits if the waits are significant enough. Here is an example
of the buffer wait statistics report:

Buffer Wait Statistics       DB/Inst: AULTDB/aultdb1Snaps: 91-92
-> ordered by wait time desc, waits desc
Class                    Waits Total Wait Time (s)  Avg Time (ms)

------------------ ----------- ------------------- --------------
data block                  13                   0              1
undo header                  1                   0             10

Enqueue Statistics

An enqueue is simply a locking mechanism. This section is very useful and must be used when the wait event "enqueue" is listed in the "Top 5 timed events".
The Enqueue activity report provides information on enqueues (higher level Oracle locking) that occur.
As with other reports, if you see high levels of wait times in these reports, you might dig further into the nature of the enqueue and determine the cause of the delays.
Here is an example of this report section:
EnqueueActivity                          DB/Inst: AULTDB/aultdb1 Snaps:91-92
-> only enqueues with waits are shown
-> Enqueue stats gathered prior to 10g should not be compared with 10g data
-> ordered by Wait Time desc, Waits desc

Enqueue Type (Request Reason)

------------------------------------------------------------------------------
    Requests    Succ Gets Failed Gets       Waits  Wt Time (s) Av Wt Time(ms)
------------ ------------ ----------- ----------- ------------ --------------
PS-PX Process Reservation
         386          358          28         116            0            .43
US-Undo Segment
         276          276           0         228            0            .18
TT-Tablespace
          90           90           0          42            0            .71
WF-AWR Flush
          12           12           0           7            0           1.43
MW-MWIN Schedule
           2            2           0           2            0           5.00
TA-Instance Undo
          12           12           0          12            0            .00
UL-User-defined
           7            7           0           7            0            .00
CF-Controlfile Transaction
       5,737        5,737           0           5            0            .00
The action to take depends on the lock type that is causing the most problems.  The most common lock waits are generally for:
- TX (Transaction Lock): Generally due to application concurrency mechanisms, or table setup issues. The TX lock is acquired when a transaction initiates its first change and is held until the transaction does a COMMIT or ROLLBACK. It is used mainly as a queuing mechanism so that other resources can wait for a transaction to complete.
- TM (DML enqueue): Generally due to application issues, particularly if foreign key constraints have not been indexed. This lock/enqueue is acquired when performing an insert, update, or delete on a parent or child table.
- ST (Space management enqueue): Usually caused by too much space management occurring. For example: create table as select on large tables on busy instances, small extent sizes, lots of sorting, etc. These enqueues are caused if a lot of space management activity is occurring on the database (such as small extent size, several sortings occurring on the disk).
V$SESSION_WAIT and V$LOCK give more data about enqueues
- The P1, P2 and P3 values tell what the enqueuemay have been waiting on
- For BF we get node#, parallelizer#, and bloom#
column parameter1 format a15
column parameter2 format a15
column parameter3 format a15
column lock format a8
Select substr(name,1,7) as "lock",parameter1,parameter2,parameter3 
from v$event_name
where name like 'enq%';

Undo Statistics Section
The undo segment summary report provides basic information on the performance of undo tablespaces.
Undo information is provided in the following sections:
- Undo Segment Summary
- Undo Segment Stats
The examples below show typical performance problem related to Undo (rollback) segments:
    - Undo Segment Summary for DB
    Undo Segment Summary for DB: S901  Instance: S901  Snaps: 2 -3
    -> Undo segment block stats:
    -> uS - unexpired Stolen,   uR - unexpired Released,   uU - unexpired reUsed
    -> eS - expired   Stolen,   eR - expired   Released,   eU - expired   reUsed
     
    Undo           Undo        Num  Max Qry     Max Tx Snapshot Out of uS/uR/uU/
     TS#         Blocks      Trans  Len (s)   Concurcy  Too Old  Space eS/eR/eU
    ---- -------------- ---------- -------- ---------- -------- ------ -------------
       1         20,284      1,964        8         12        0      0 0/0/0/0/0/0
    The description of the view V$UNDOSTAT in the Oracle Database Reference guide provides some insight as to the columns definitions.  Should the client encounter SMU problems, monitoring this view every few minutes would provide more useful information.
    - Undo Segment Stats for DB
    Undo Segment Stats for DB: S901  Instance: S901  Snaps: 2 -3
    -> ordered by Time desc
     
                         Undo      Num Max Qry   Max Tx  Snap   Out of uS/uR/uU/
    End Time           Blocks    Trans Len (s)    Concy Too Old  Space eS/eR/eU
    ------------ ------------ -------- ------- -------- ------- ------ -------------
    12-Mar 16:11       18,723    1,756       8       12       0      0 0/0/0/0/0/0
    12-Mar 16:01        1,561      208       3       12       0      0 0/0/0/0/0/0
    This section provides a more detailed look at the statistics in the previous section by listing the information as it appears in each snapshot.Use of UNDO_RETENTION can potentially increase the size of the undo segment for a given period of time, so the retention period should not be arbitrarily set too high. The UNDO tablespace still must be sized appropriately. The following calculation can be used to determine how much space a given undo segment will consume given a set value of UNDO_RETENTION.
    Undo Segment Space Required = (undo_retention_time * undo_blocks_per_seconds)
    As an example, an UNDO_RETENTION of 5 minutes (default) with 50 undo blocks/second (8k blocksize) will generate:
    Undo Segment Space Required = (300 seconds * 50 blocks/ seconds * 8K/block) = 120 M
    The retention information (transaction commit time) is stored in every transaction table block and each extent map block. When the retention period has expired, SMON will be signaled to perform undo reclaims, done by scanning each transaction table for undo timestamps and deleting the information from the undo segment extent map. Only during extreme space constraint issues will retention period not be obeyed.

Latch Statistics Section

The latch activity report provides information on Oracle's low level locking mechanism called a latch. From this report you can determine if Oracle is suffering from latching problems, and if so, which latches are causing the greatest amount of contention on the system.
Latch information is provided in the following three sections:
. Latch Activity
. Latch Sleep breakdown
. Latch Miss Sources
This information should be checked whenever the "latch free" wait event or other latch wait events experience long waits. This section is particularly useful for determining latch contention on an instance.  Latch contention generally indicates resource contention and supports indications of it in other sections. Latch contention is indicated by a Pct Miss of greater than 1.0% or a relatively high value in Avg Sleeps/Miss. While each latch can indicate contention on some resource, the more common latches to watch are:
cache buffer chain= The cache buffer chain latch protects the hash chain of cache buffers, and is used for each access to cache buffers. Contention for this latch can often only be reduced by reducing the amount of access to cache buffers. Using the X$BH fixed table can identify if some hash chains have many buffers associated with them. Often, a single hot block, such as an index root block, can cause contention for this latch. Contention on this latch confirms a hot block issue.
shared pool= The shared pool latch is heavily used during parsing, in particular during hard parse. If your application is written so that it generally uses literals in stead of bind variables, you will have high contention on this latch. Contention on this latch in conjunction with reloads in the SQL Area of the library cache section indicates that the shared pool is too small. You can set the cursor_sharing parameter in init.ora to the value ‘force’ to reduce the hard parsing and reduce some of the contention for the shared pool latch. Applications that are coded to only parse once per cursor and execute multiple times will almost completely avoid contention for the shared pool latch.
  • Literal SQL is being used. See Note 62143.1 'Understanding and Tuning the Shared Pool for an excellent discussion of this topic.
  • The parameter session_cached_cursors might need to be set.  See enhancement bug 1589185 for details.
library cache= The library cache latch is heavily used during both hard and soft parsing. If you have high contention for this latch, your application should be modified to avoid parsing if at all possible. Setting the cursor_sharing parameter in init.ora to the value ‘force’ provides some reduction in the library cache latch needs for hard parses, and setting the session_cached_cursors sufficiently high provides some reduction in the library cache latch needs for repeated soft parsing within a single session. There is minor contention for this latch involved in executing SQL statements, which can be reduced further by setting cursor_space_for_time=true, if the application is properly written to parse statements once and execute multiple times.
row cache= The row cache latch protects the data dictionary information, such as information about tables and columns. During hard parsing, this latch is used extensively. The cursor_sharing parameter can be used to completely avoid the row cache latch lookup during parsing.
cache buffer lru chain= The buffer cache has a set of chains of LRU block, each protected by one of these latches. Contention for this latch can often be reduced by increasing the db_block_lru_latches parameter or by reducing the amount of access to cachebuffers.

Here is a partial example of the latch activity report (it is quite long):

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
ASM allocation                      122    0.0    N/A      0            0    N/A
ASM map headers                      60    0.0    N/A      0            0    N/A
ASM map load waiting lis             11    0.0    N/A      0            0    N/A
ASM map operation freeli             30    0.0    N/A      0            0    N/A
ASM map operation hash t         45,056    0.0    N/A      0            0    N/A
ASM network background l          1,653    0.0    N/A      0            0    N/A
AWR Alerted Metric Eleme         14,330    0.0    N/A      0            0    N/A
Consistent RBA                      107    0.0    N/A      0            0    N/A
FAL request queue                    75    0.0    N/A      0            0    N/A
FAL subheap alocation                75    0.0    N/A      0            0    N/A
FIB s.o chain latch                  14    0.0    N/A      0            0    N/A
FOB s.o list latch                   93    0.0    N/A      0            0    N/A
JS broadcast add buf lat            826    0.0    N/A      0            0    N/A
JS broadcast drop buf la            826    0.0    N/A      0            0    N/A

In this example our database does not seem to be experiencing any major latch problems, as the wait times on the latches are 0, and our get miss pct (Pct Get Miss) is 0 also.

There is also a latch sleep breakdown report which provides some additional detail if a latch is being constantly moved into the sleep cycle, which can cause additional performance issues.

The latch miss sources report provides a list of latches that encountered sleep conditions. This report can be of further assistance when trying to analyze which latches are causing problems with your database.

Segments Statistics Sections
This is a series of reports that let you identify objects that are heavily used. It contains several sub-sections like:

Segments by Logical Reads
Segments by Physical Reads
Segments by Physical Read Requests
Segments by UnOptimized Reads
Segments by Optimized Reads
Segments by Direct Physical Reads
Segments by Physical Writes
Segments by Physical Write Requests
Segments by Direct Physical Writes
Segments by Table Scans
Segments by DB Blocks Changes
Segments by Row Lock Waits
Segments by ITL Waits
Segments by Buffer Busy Waits

Segments by Logical Reads and Segments by Physical Reads
The "segments by logical reads" and "segments by physical reads" reports provide information on the database segments (tables, indexes) that are receiving the largest number of logical or physical reads. These reports can help you find objects that are "hot" objects in the database. You may want to review the objects and determine why they are hot, and if there are any tuning opportunities available on those objects (e.g. partitioning), or on SQL accessing those objects.
For example, if an object is showing up on the physical reads report, it may be that an index is needed on that object. Here is an example of the segments by logical reads report:

Segments by Logical Reads
  • Total Logical Reads: 393,142,567
  • Captured Segments account for 99.4% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypeLogical Reads%Total
FIPFGUARDFG_DATASIGNATURES TABLE320,674,17681.57
FIPFGUARDFG_DATASIGNATORY TABLE30,730,6887.82
FIPFGUARDFG_DATADIBATCH TABLE6,246,5761.59
FIPFGUARDFG_DATA_ARCHFLOWDOCUMENT_ARCH TABLE6,202,2561.58
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE300TABLE PARTITION6,134,3361.56


Segments by Physical Reads
Queries using these segments should be analyzed to check whether any FTS is happening on these segments. In case FTS is happening then proper indexes should be created to eliminate FTS.
Most of these SQLs can be found under section SQL Statistics -> SQL ordered by Reads.

  • Total Physical Reads: 415,478,983
  • Captured Segments account for 86.3% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypePhysical Reads%Total
FIPFGUARDFG_DATASIGNATURES TABLE320,331,03277.10
FIPFGUARDFG_DATASIGNATORY TABLE30,610,2107.37
FIPFGUARDFG_DATA_ARCHFLOWDOCUMENT_ARCH TABLE6,056,6041.46
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE300TABLE PARTITION360,3460.09
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE400TABLE PARTITION355,6480.09

Several segment related reports appear providing information on:
•Segments with ITL waits
•Segments with Row lock waits
•Segments with buffer busy waits
•Segments with global cache buffer waits
•Segments with CR Blocks received
•Segments with current blocks received

Segments by Physical Read Requests
  • Total Physical Read Requests: 4,701,222
  • Captured Segments account for 60.7% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypePhys Read Requests%Total
FIPFGUARDFG_DATASIGNATURES TABLE2,509,36953.38
FIPFGUARDFG_DATASIGNATORY TABLE266,2345.66
FIPFGUARDFG_DATA_ARCHFLOWDOCUMENT_ARCH TABLE47,5081.01
FIPFGUARDFG_DATAACCOUNT TABLE9,0170.19
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE400TABLE PARTITION5,8060.12

Segments by UnOptimized Reads
  • Total UnOptimized Read Requests: 4,701,222
  • Captured Segments account for 60.7% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypeUnOptimized Reads%Total
FIPFGUARDFG_DATASIGNATURES TABLE2,509,36953.38
FIPFGUARDFG_DATASIGNATORY TABLE266,2345.66
FIPFGUARDFG_DATA_ARCHFLOWDOCUMENT_ARCH TABLE47,5081.01
FIPFGUARDFG_DATAACCOUNT TABLE9,0170.19
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE400TABLE PARTITION5,8060.12


Segments by Direct Physical Reads
  • Total Direct Physical Reads: 415,248,809
  • Captured Segments account for 86.3% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypeDirect Reads%Total
FIPFGUARDFG_DATASIGNATURES TABLE320,331,86477.14
FIPFGUARDFG_DATASIGNATORY TABLE30,607,8767.37
FIPFGUARDFG_DATA_ARCHFLOWDOCUMENT_ARCH TABLE6,056,6041.46
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE300TABLE PARTITION357,5760.09
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE400TABLE PARTITION355,0000.09

Segments by Physical Writes
  • Total Physical Writes: 57,054,872
  • Captured Segments account for 0.1% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypePhysical Writes%Total
FIPFGUARDFG_DATAPROCESSLOG TABLE28,6190.05
FIPFGUARDFG_DATAUN_FD_ACCTSERIALROUTSEQNUMBER INDEX5,4280.01
** MISSING **TEMPFG** MISSING: 501101/4223360** MISSING **UNDEFINED2,0700.00
** MISSING **TEMPFG** MISSING: 501102/4265728** MISSING **UNDEFINED1,9880.00
SYSSYSAUXI_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST INDEX1,4820.00

Segments by Physical Write Requests
  • Total Physical Write Requestss: 1,866,713
  • Captured Segments account for 0.9% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypePhys Write Requests%Total
FIPFGUARDFG_DATAUN_FD_ACCTSERIALROUTSEQNUMBER INDEX3,7760.20
FIPFGUARDFG_DATAPROCESSLOG TABLE2,6190.14
SYSSYSAUXI_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST INDEX1,1210.06
FIPFGUARDFG_DATASIGNATURES TABLE7960.04
SYSSYSTEMHISTGRM$ TABLE7410.04

Segments by Direct Physical Writes
  • Total Direct Physical Writes: 56,969,427
  • Captured Segments account for 0.0% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypeDirect Writes%Total
** MISSING **TEMPFG** MISSING: 501101/4223360** MISSING **UNDEFINED2,0700.00
** MISSING **TEMPFG** MISSING: 501102/4265728** MISSING **UNDEFINED1,9880.00
SYSSYSAUXWRH$_ACTIVE_SESSION_HISTORYWRH$_ACTIVE_750434027_20743TABLE PARTITION980.00
SYSSYSAUXSYS_LOB0000006306C00038$$ LOB70.00

Segments by Table Scans
  • Total Table Scans: 18,527
  • Captured Segments account for 95.6% of Total
OwnerTablespace NameObject NameSubobject NameObj. TypeTable Scans%Total
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE400TABLE PARTITION6,59735.61
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE300TABLE PARTITION6,18733.39
FIPFGUARDFG_DATASIGNATORY TABLE1,5088.14
FIPFGUARDFG_DATASIGNATURES TABLE1,5088.14
FIPFGUARDFG_INDXFLOWDOCUMENTFDSTATE200TABLE PARTITION5012.70

Segments by DB Blocks Changes
  • % of Capture shows % of DB Block Changes for each top segment compared
  • with total DB Block Changes for all segments captured by the Snapshot
OwnerTablespace NameObject NameSubobject NameObj. TypeDB Block Changes% of Capture
FIPFGUARDFG_DATAPROCESSLOG TABLE175,28018.63
FIPFGUARDFG_INDXPK_PROCESSLOG INDEX109,20011.61
SYSSYSTEMI_H_OBJ#_COL# INDEX107,23211.40
SYSSYSTEMHISTGRM$ TABLE104,68811.13
FIPFGUARDFG_INDXFK_PROCESSLOG_PROCESSID INDEX104,01611.06

Segments by Row Lock Waits

Owner
Tablespace Name
Object Name
Subobject Name
Obj. Type
Row Lock Waits
% of Capture
RRA_OWNER
RRA_DATA
RRA_SRF_IX_04

INDEX
6,907
20.18
RRA_OWNER
RRA_INDEX
RRA_PROCSTATUS_IX_03

INDEX
3,918
11.45
RRA_OWNER
RRA_INDEX
RRA_REPTRN_PK

INDEX
3,118
9.11
RRA_OWNER
RRA_DATA
TRRA_BALANCE_STATUS

TABLE
1,750
5.11
RRA_OWNER
RRA_INDEX
RRA_PROCSTATUS_IX_02

INDEX
1,178
3.44

The statistic displays segment details based on total “Row lock waits” which happened during snapshot period. Data displayed is sorted on “Row Lock Waits” column in descending order. It provides information about segments for which more database locking is happening.
DML statements using these segments should be analysed further to check the possibility of reducing concurrency due to row locking.

Segments by ITL Waits

Owner
Tablespace Name
Object Name
Subobject Name
Obj. Type
ITL Waits
% of Capture
RRA_OWNER
RRA_INDEX
RRA_MSGBLOBS_IX_01

INDEX
23
27.06
RRA_OWNER
RRA_INDEX
RRA_TRN_IX_08

INDEX
15
17.65
RRA_OWNER
RRA_INDEX
RRA_INT_CLOB_IX_01

INDEX
10
11.76
RRA_OWNER
RRA_INDEX
RRA_TRN_IX_05

INDEX
10
11.76
RRA_OWNER
RRA_INDEX
RRA_TRN_IX_10

INDEX
8
9.41

Whenver a transaction modifies segment block, it first add transaction id in the Internal Transaction List table of the block. Size of this table is a block level configurable parameter. Based on the value of this parameter those many ITL slots are created in each block.
ITL wait happens in case total trasactions trying to update same block at the same time are greater than the ITL parameter value.
Total waits happening in the example are very less, 23 is the Max one. Hence it is not recommended to increase the ITL parameter value.

Segments by Buffer Busy Waits

Owner
Tablespace Name
Object Name
Subobject Name
Obj. Type
Buffer Busy Waits
% of Capture
RRA_OWNER
RRA_INDEX
RRA_REPTRN_PK

INDEX
4,577
26.69
RRA_OWNER
RRA_INDEX
RRA_REPBAL_IX_03

INDEX
1,824
10.64
RRA_OWNER
RRA_INDEX
RRA_PROCSTATUS_IX_03

INDEX
1,715
10.00
RRA_OWNER
RRA_INDEX
RRA_MSGINB_PK

INDEX
827
4.82
RRA_OWNER
RRA_INDEX
RRA_PROCSTATUS_PK

INDEX
696
4.06

Buffer busy waits happen when more than one transaction tries to access same block at the same time. In this scenario, the first transaction which acquires lock on the block will able to proceed further whereas other transaction waits for the first transaction to finish.
If there are more than one instances of a process continuously polling database by executing same SQL (to check if there are any records available for processing), same block is read concurrently by all the instances of a process and this result in Buffer Busy wait event.


Retrieve SQL and Execution Plan from AWR Snapshots
This is a simple script that can help you to collect SQL statements executed since yesterday (configurable) that contains a specific value in its sentence.

col parsed format a6
col sql_text format a40
set lines 200
set pages 300
select sql_text, parsing_schema_name as parsed, elapsed_time_delta/1000/1000 as elapsed_sec, stat.snap_id,
       to_char(snap.end_interval_time,'dd.mm hh24:mi:ss') as snaptime, txt.sql_id
from dba_hist_sqlstat stat, dba_hist_sqltext txt, dba_hist_snapshot snap
where stat.sql_id=txt.sql_id
  and
 stat.snap_id=snap.snap_id
  and
 snap.begin_interval_time >= sysdate-1
  and
 lower(sql_text) like '%&sql_test%'
  and
 parsing_schema_name not in ('SYS','SYSMAN','MDSYS','WKSYS')
order by elapsed_time_delta asc;

This will show something like:
Enter value for sql_test: delete
old   7:   and lower(sql_text) like '%&sql_test%'
new   7:   and lower(sql_text) like '%delete%'
SQL_TEXT                                 PARSED ELAPSED_SEC    SNAP_ID SNAPTIME
      SQL_ID
---------------------------------------- ------ ----------- ---------- ---------
----- -------------
DELETE FROM WWV_FLOW_FILE_OBJECTS$ WHERE APEX_0     .484942        688 23.08 16:
00:54 8rpn8jtjnuu73
 SECURITY_GROUP_ID = 0                   30200

Then with that sql_id, we can retrieve the execution plan from the snapshots:
select plan_table_output from table (dbms_xplan.display_awr('&sqlid'));

Enter value for sqlid: 8rpn8jtjnuu73

old   1: select plan_table_output from table (dbms_xplan.display_awr('&sqlid'))
new   1: select plan_table_output from table (dbms_xplan.display_awr('8rpn8jtjnuu73'))

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------

SQL_ID 8rpn8jtjnuu73
--------------------
DELETE FROM WWV_FLOW_FILE_OBJECTS$ WHERE SECURITY_GROUP_ID = 0
Plan hash value: 358826532

-------------------------------------------------------------------------------------
| Id  | Operation         | Name                       | Rows  | Bytes | Cost (%CPU)|
-------------------------------------------------------------------------------------
|   0 | DELETE STATEMENT  |                            |       |       |     1 (100)|
|   1 |  DELETE           | WWV_FLOW_FILE_OBJECTS$     |       |       |            |
|   2 |   INDEX RANGE SCAN| WWV_FLOW_FILES_SGID_FK_IDX |     1 |   202 |     0   (0)|
-------------------------------------------------------------------------------------



Get Data from ASH
If you need to quickly check a performance problem on your DB, ASH is great here
We sample the Wait-Events of active sessions every second into the ASH-Buffer.
It is accessed most comfortable with the Enterprise Manager GUI from the Performance Page (Button ASH Report there).
Or with little effort from the command line like this:

-----------------------------------------
-- Top 10 CPU consumers in last 5 minutes
-----------------------------------------
select * 
from (select session_id, session_serial#, count(*)
         from v$active_session_history
         where session_state= 'ON CPU'
           and sample_time > sysdate - interval '5' minute
         group by session_id, session_serial#
         order by count(*) desc
     )
where rownum <= 10;


--------------------------------------------
-- Top 10 waiting sessions in last 5 minutes
--------------------------------------------
select * 
from (select session_id, session_serial#,count(*)
        from v$active_session_history
        where session_state='WAITING'
          and sample_time >  sysdate - interval '5' minute
        group by session_id, session_serial#
        order by count(*) desc
      )
where rownum <= 10;



-- These 2 queries should spot the most incriminating sessions of the last 5 minutes. 
-- But who is that and what SQL was running?


--------------------
-- Who is that SID?
--------------------
set lines 200
col username for a10
col osuser for a10
col machine for a10
col program for a10
col resource_consumer_group for a10
col client_info for a10

select  serial#, username, osuser, machine, program, resource_consumer_group, client_info
from v$session 
where sid = &sid;


-------------------------
-- What did that SID do?
-------------------------
select distinct sql_id, session_serial# 
from v$active_session_history
where sample_time >  sysdate - interval '5' minute
and session_id = &sid;


----------------------------------------------
-- Retrieve the SQL from the Library Cache:
----------------------------------------------
col sql_text for a80
select sql_text from v$sql where sql_id='&sqlid';




Moving AWR information
Enterprise Manager allows administrators to transfer Automatic Workload Repository snapshots to other workload repositories for offline analysis. This is accomplished by the administrator specifying a snapshot range and extracting the AWR data to a flat file. The flat file is then loaded into a user-specified staging schema in the target repository. To complete the transfer, the data is copied from the staging schema into the target repository's SYS schema. The data in the SYS schema is then used as the source for the ADDM analysis.
If the snapshot range already exists in the SYS or staging schemas, the data being imported is ignored. All data in snapshot ranges that does not conflict with existing data is loaded. Oracle contains a new package DBMS_SWRF_INTERNAL to provide AWR snapshot export and import functionality.
The example below exports a snapshot range starting with 100 and ending at 105 to the output dump file 'awr_wmprod1_101_105' in the directory '/opt/oracle/admin/awrdump/wmprod1':
BEGIN
DBMS_SWR_INTERNAL.AWR_EXTRACT(
DMPFILE =>'awr_export_wmprod1_101_105',
DMPDIR => '/opt/oracle/admin/awrdump/wmprod1',
BID => 101,
EID => 105)

We then use the AWR_LOAD procedure to load the data into our target repository staging schema:
BEGIN
DBMS_SWR_INTERNAL.AWR_LOAD(
SCHNAME => 'foot',
DMPFILE =>'awr_export_wmprod1_101_105',
DMPDIR => '/opt/oracle/admin/awrdump/wmprod1')
The last step is to transfer the data from our staging schema (FOOT) to the SYS schema for analysis:
BEGIN
DBMS_SWR_INTERNAL.MOVE_TO_AWR(SCHNAME => 'foot',)