DBA > Articles

Using Database Advisors

By: Sushma Jagannath
To read more DBA articles, visit http://dba.fyicenter.com/article/

Get advice on key management challenges and improve performance in Oracle Database 11g.

Advisors are powerful tools that provide specific advice on how to address key database management challenges, covering a wide range of areas, including space, performance, and undo management. Advisors are built around two infrastructure components:

Automatic workload repository (AWR). This repository provides services for collecting, maintaining, and utilizing statistics for problem detection and self-tuning purposes. The statistical information is stored in the AWR in the form of snapshots.

Automatic database diagnostic monitor (ADDM). This monitor performs analysis, detects bottlenecks, and recommends solutions. Recommendations can include the type of advisor that needs to be used to resolve the problem.

This column focuses on some of the database advisors that are invoked by ADDM to help you improve database performance. It presents sample questions of the type you may encounter when taking the Oracle Database 11g Administration Workshop I exam, which enables you to earn the Oracle Certified Associate level of certification.

SQL Tuning Advisor
The SQL tuning advisor analyzes problems with individual SQL statements, such as a poorly performing optimizer plan or the mistaken use of certain SQL structures, and makes recommendations for improving their performance. You can run the SQL tuning advisor against resource-intensive SQL statements, a set of SQL statements over a period of time, or from a SQL workload. Typically, you run this advisor in response to an ADDM performance finding that recommends its use.

Oracle Database 11g introduces the automatic SQL tuning advisor, which can be configured to automatically run during system maintenance windows as a maintenance task. During each automatic run, the advisor selects high-load SQL queries in the system and generates recommendations on how to tune them.

John starts to create a new table based on data in the customer table. The following criteria must be applied on the data:
* All columns of the customer table must be available in the new table.
* The new table must have data for only those customers whose average order is US$1 million or more per quarter, who have not made payments for the last two orders, and whose payment period has exceeded the credit period.

John notices that the table-creation process is taking very long to complete. The DBA has enabled the automatic SQL tuning advisor with automatic implementation, but when he runs the SQL tuning advisor, he notes that this SQL statement was poorly formed and not automatically tuned. Why did the server not automatically tune this statement?

A. The automatic SQL tuning advisor ignores CREATE TABLE AS SELECT statements.
B. The automatic SQL tuning advisor ignores CREATE TABLE statements.
C. The automatic SQL tuning advisor tunes only SQL queries.
D. The automatic SQL tuning advisor does not tune DML statements.

The correct answer is A. Even though the automatic SQL tuning advisor is enabled, it does not resolve every SQL performance issue. It does not automatically resolve issues with the following types of SQL statements: CREATE TABLE AS SELECT and INSERT SELECT, ad hoc or rarely repeated SQL, parallel queries, and recursive SQL.

You have received complaints about the degradation of SQL query performance and have identified the most-resource-intensive SQL queries. What is your next step to get recommendations about restructuring the SQL statements to improve query performance?

A. Run the segment advisor
B. Run the SQL tuning advisor on the most-resource-intensive SQL statements
C. Run the AWR report
D. Run ADDM on the most-resource-intensive SQL statements

The correct answer is B. After you have identified the SQL statements that are the most resource intensive, you use the SQL tuning advisor to get recommendations on how to tune them. Answer A is incorrect because the segment advisor reports on the growth trend of segments and provides recommendations on whether a segment needs to be shrunk. Answer C is incorrect because AWR is a repository that stores performance-related information in the form of snapshots. Answer D is incorrect because ADDM uses these statistics to perform analysis and detect bottlenecks and then recommends solutions.

SQL Access Advisor
The SQL access advisor provides recommendations for improving the performance of a workload. In addition to analyzing indexes and materialized views as in Oracle Database 10g, the SQL access advisor in Oracle Database 11g analyzes tables and queries and provides recommendations on optimizing storage structures.

The SQL access advisor tunes a schema to a particular workload. Typically, when you use the SQL access advisor for performance tuning, you perform the following steps: create a task, define the workload, generate recommendations, and implement recommendations.

You can use the SQL access advisor to receive recommendations on which of the following:

A. Schema modifications
B. Tuning resource-intensive SQL statements
C. Improving the execution plan of SQL statements
D. SQL workload

The correct answers are A and D. The SQL access advisor analyzes an entire workload and recommends changes to indexes, materialized views, and tables to improve performance. Answers B and C are incorrect because the SQL tuning advisor makes recommendations on tuning resource-intensive SQL statements and improving the execution plan of SQL statements.

Memory Advisor The memory advisor is a collection of several advisory functions that help determine the best settings for the total memory used by the database instance. They provide graphical analyses of total memory target settings (as shown in Figure 1), SGA and PGA target settings, or SGA component size settings. You use these analyses to tune database performance and for what-if planning. Several memory advisors are available for memory tuning (note that the availability of these advisors depends on whether the automatic memory management [AMM] and the automatic shared memory management [ASMM] features are enabled or disabled): The SGA advisor provides information about percentage improvement in DB (database) time for various sizes of SGA, the shared pool advisor provides information about the estimated parse time in the shared pool for different pool sizes, the buffer cache advisor provides information about physical reads and time for the cache size, and the PGA advisor provides information about cache hit percentage against PGA target memory size.

Full article...

Other Related Articles

... to read more DBA articles, visit http://dba.fyicenter.com/article/