Skip Headers
Oracle® Database 2 Day DBA
10g Release 2 (10.2)

Part Number B14196-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

Using Advisors to Optimize Database Performance

Advisors are powerful tools for database management. They provide specific advice on how to address key database management challenges, covering a wide range of areas including space, performance, and undo management. In general, advisors produce more comprehensive recommendations than alerts. This is because alert generation is intended to be low cost and have minimal impact on performance, whereas advisors are user-invoked, consume more resources, and perform more detailed analysis. This, along with the what-if capability of some advisors, provides vital information for tuning that cannot be procured from any other source.

About Performance Advisors

This section deals primarily with the advisors that can improve performance. These advisors include the SQL Tuning, SQL Access, and Memory Advisors. Table 10-1, "Performance Advisors" describes these advisors.

Other advisors such as the Undo and Segment Advisors are listed in Table 10-2, "Other Advisors".

For example, the shared pool memory advisor graphically displays the impact on performance of changing the size of this component of the SGA.

You can run an advisor when faced with the following situations:

  • You want to resolve a problem in a specific area, for example, to determine why a given SQL statement is consuming 50 percent of CPU time and what to do to reduce its resource consumption.You can use the SQL Tuning Advisor.

  • During application development, you want to tune new schema and its associated SQL workload for optimal performance. You can use the SQL Access Advisor.

  • You are planning to add memory to your system. You can use the Memory Advisor to determine the database performance impact of increasing your SGA or PGA.

Table 10-1 describes the performance advisors that Oracle provides. These advisors are described in this chapter.

Table 10-1 Performance Advisors

Advisor Description

Automatic Database Diagnostic Monitor (ADDM)

ADDM makes it possible for the Oracle Database to diagnose its own performance and determine how any identified problems can be resolved.See "Performance Self-Diagnostics: Automatic Database Diagnostics Monitor" and "Diagnosing Performance Problems".

SQL Tuning Advisor

This advisor analyzes SQL statements and makes recommendations for improving performance. See "Using the SQL Tuning Advisor".

SQL Access Advisor

Use this advisor to tune schema to a given SQL workload. For example, the SQL Access Advisor can provide recommendations for creating indexes and materialized views for a given workload. See "Using the SQL Access Advisor".

Memory Advisor

  • Shared Pool Advisor (SGA)

  • Buffer Cache Advisor (SGA)

  • PGA Advisor

By default, Oracle automatically tunes physical memory allocation for optimal performance. The Memory Advisor gives graphical analysis of SGA and PGA settings, which you can use for what-if planning. See "Using the Memory Advisor".


Table 10-2, "Other Advisors" describes other advisors Oracle provides. These are described elsewhere in this book.

Table 10-2 Other Advisors

Advisor Description

Segment Advisor

The Segment Advisor provides advice on whether an object is a good candidate for a shrink operation based on the level of space fragmentation within that object. The advisor also reports on the historical growth trend of segments. You can use this information for capacity planning and for arriving at an informed decision about which segments to shrink. See "Reclaiming Wasted Space" in Chapter 6, "Managing Database Storage Structures".

Undo Advisor

The Undo Advisor helps identify problems in the undo tablespace and assists in correctly sizing the undo tablespace. The Undo Advisor can also be used to set the low threshold value of the undo retention period for any flashback requirements. See "Using the Undo Advisor" in Chapter 6, "Managing Database Storage Structures".


You can run an advisor from the Advisor Central home page, accessible through a link on the Database Home page. You can invoke advisors in other ways, often through recommendations from ADDM or alerts.

Using the SQL Tuning Advisor

Use the SQL Tuning Advisor for tuning SQL statements. Typically, you can run this advisor in response to an ADDM performance finding that recommends its use.

Additionally, you can run the SQL Tuning Advisor on the most resource-intensive SQL statements, as well as on a SQL workload.


See Also:

For more information about the SQL Tuning advisor, see Oracle Database Performance Tuning Guide

To run the SQL Tuning Advisor do the following:

  1. On the Home Page, under Related Links, click Advisor Central, then click SQL Tuning Advisor. The SQL Tuning Advisor Links page appears.

  2. The advisor can be run on one of the following sources:

    • Top Activity—The most resource intensive SQL statements executed during the last hour. Use this option to tune SQL statements that might have caused recent performance problems.

    • Period SQL— A set of SQL statements over any 24 hour window. Use this option for pro-active tuning of SQL statements.

    • SQL Tuning Sets (STS)—A set of SQL statements you provide. An STS can be created from SQL statements captured by AWR snapshots or from any SQL workload.

    • Snapshots—A set of SQL statements from an AWR snapshot.

    • Preserved Snapshot Sets—A set of SQL statements from a preserved snapshot set.

  3. For example, select Top Activity.

    The Top Activity page appears. This page has a graph showing the active sessions over the last hour.You can select an five minute interval to analyze by clicking the bar under the time line. The Top SQL and Top Sessions tables show the activity within the selected period. You can select one or more SQL statements to analyze.

  4. Click Schedule SQL Tuning Advisor.

    The Schedule Advisor page appears showing the SQL statements in the interval. Give your task a name and description, select the scope for the analysis (Comprehensive or Limited), and select a start time for the task. Click OK.

  5. The SQL Tuning Result page appears. To view recommendations, select the SQL statement and click View Recommendations. The recommendation can include one or more of the following:

    • Accept the SQL profile, which contains additional SQL statistics specific to the statement that enables the query optimizer to generate a significantly better execution plan at runtime.

    • Gather optimizer statistics on objects with outdated or no statistics

    • Advice on how to rewrite a query for better performance.

    • Create an index to offer alternate, faster access paths to the query optimizer.

Using the SQL Access Advisor

The SQL Access Advisor helps define appropriate access structures such as indexes and materialized views to optimize SQL queries. The advisor takes a SQL workload as an input and recommends which indexes, materialized views, or logs to create, drop, or retain for faster performance. You can select your workload from different sources including current and recent SQL activity, a SQL repository, or a user-defined workload such as from a development environment.

The recommendations that this advisor makes include possible indexes, materialized views, or materialized view logs that can improve your query performance for the given workload.

Note that both SQL Tuning and Access advisor provide index creation recommendations. The SQL Tuning advisor recommends creation of indexes only when it anticipates exceptional performance gains for the SQL statement being tuned. However, creation of new indexes may adversely impact the performance of DML (inserts, updates, and deletes) operations. The SQL Tuning advisor does not take this into account while generating new index recommendations.

The SQL Access Advisor on the other hand considers the impact of new indexes on the complete workload. As such, if an index improves performance of one SQL statement but adversely impacts the rest of the workload, the new index won't be recommended by the SQL Access advisor. For this reason, the SQL Tuning advisor always recommends validating its new index recommendation by running the SQL Access Advisor.


See Also:

For more information about the SQL Access advisor, see Oracle Database Performance Tuning Guide

To run the SQL Access advisor:

  1. Navigate to the Advisor Central page, and click SQL Access Advisor. This begins a wizard which prompts you for your initial options. Select Use Default Options. Click Continue.

  2. The Workload Source page appears. Select your workload source as Current and Recent SQL Activity to analyze the most recent and ongoing activity. You can also select from other sources. The best workload is one that fully represents the statements that access all the underlying tables. Click Next.

  3. The Recommendations Options page appears. Select if you want the advisor to recommend indexes, materialized views, or both. You can also choose to perform an evaluation only, which returns information on the objects being accessed by the workload, but does not recommend any new structures.

    You can choose to run the advisor in limited or comprehensive mode. Limited mode runs faster by concentrating on highest cost statements. You can ignore the Advanced Options for now. Click Next.

  4. The Schedule page appears. Ensure your task has a name and description. Under Start, select Immediately. Click Next.

  5. The Review page appears. Review your options and click Submit.

  6. The Advisor Central page appears. A confirmation message appears, indicating that your task has been created successfully. Click Refresh to view the status of your task.

  7. When your SQL Access Advisor task has completed, select View Result. The Result for Task page appears.

    The Summary page shows you the potential for improvement under the headings Workload I/O Cost and Query Execution Time Improvement.

    The Recommendations page shows the recommendations, if any, for improving performance. A recommendation might consist of a SQL script with one or more CREATE INDEX statements, which you can run by clicking Schedule Implementation.

Using the Memory Advisor

Adequate physical memory has a significant impact on the performance of your Oracle Database. The SGA and PGA target initialization parameters determine the amount of physical memory available to the database. When you use the DBCA to create your database, the initial value of these parameters is configured according to your workload type and the total amount of memory available on your machine.

With Oracle's automatic memory management capabilities, Oracle automatically adjusts the memory distribution among the various SGA and PGA sub-components for optimal performance. These adjustments are made within the boundaries of your total SGA and PGA target values.

ADDM periodically evaluates the performance of your database to determine performance bottlenecks. If ADDM finds that the current amount of available memory is inadequate and adversely affecting performance, it can recommend that you increase your SGA or PGA target value. You can set new values for the SGA and PGA using the Memory Advisor.

Additionally, you can use the Memory Advisor to perform what-if analysis on:

  • The database performance benefits of adding physical memory to your database.

  • The database performance impact of reducing the physical memory available to your database.

Optionally, you can use the Memory Advisor to set a new value for the SGA and PGA targets, based on what-if analysis.


See Also:

For more information about memory configuration, see Oracle Database Performance Tuning Guide

Setting New SGA or PGA Targets

As a response to an ADDM performance finding, you can use the Memory Advisor to set a new SGA or PGA target. In the user-interface, these parameters correspond to Total SGA Size and Aggregate PGA Target.

To set a new SGA target:

  1. Navigate to the memory advisor in one of the following ways:

    • From the Home Page, under related links, click Advisor Central, then Click Memory Advisor.

    • From the Administration page, under Database Configuration, click Memory Parameters.

      The Memory Parameters: SGA page appears. This page gives the breakdown of memory allocation for the system global area (SGA) and its subcomponents such as the buffer cache and shared pool. For more information about these components, see "Instance Memory Structure" in Chapter 5, "Managing the Oracle Instance".

  2. To set a new SGA size, enter the new amount for Total SGA Size. The new value must be less than the maximum SGA. Click Apply. A confirmation message appears.

Similarly, to set a new PGA size:

  1. Navigate to the PGA property page. This page shows the current value for the Aggregate PGA Target, as well as the current allocation of PGA memory. For more information about the PGA, see "Instance Memory Structure" in Chapter 5, "Managing the Oracle Instance".

  2. Enter the new amount next to Aggregate PGA Target. Click Apply. A confirmation message appears.

Determining Performance Impact for Altering your SGA or PGA

You can use the Memory Advisor to do what-if analysis for adding or removing physical memory to your database. This advisor graphically analyses the database performance impact of altering your SGA or PGA targets.

To gain advice on configuring the total size of your SGA, on the Memory Parameters: SGA Page, click Advice next to Total SGA Size.

The SGA Advice graph appears. Refer to Figure 10-8, "SGA Size Advice".

Improvement in DB Time (%) is plotted against Total SGA size. A higher number for Improvement in DB Time is better for performance. In this example, the graph tells us that an SGA size larger than 1000MB will not improve performance by much. Thus 1000MB is the recommended optimal SGA size.

Figure 10-8 SGA Size Advice

Description of Figure 10-8 follows
Description of "Figure 10-8 SGA Size Advice"

Similarly, to run the PGA advisor, navigate to the PGA property page. Next to Aggregate PGA Target, click Advice. The PGA Target Advice Page appears, plotting Cache hit percentage against PGA Target memory size.

Cache hit percentage is the percentage of read requests serviced by memory, as opposed to those requests serviced by reading from disk, which is slower. A higher hit percentage indicates better cache performance. The optimal zone for cache hit percentage is between 75 and 100 percent. However, it is not safe to conclude that your database is having performance problems simply because your cache hit percentage is not within the optimal zone. When the amount of currently available PGA memory is not adequate for optimal performance, ADDM will automatically recommend adjusting this value with a performance finding.