Question: What do
I do to run the SQL tuning advisor outside of Enterprise
Manager (OEM)? I want to run the SQL tuning advisor
from the commands line in SQL*Plus. Can you show the
procedure for running the SQL Tuning advisor from the
command line using dbms_sqltune?
Answer: You can do the SQL Tuning
advisor in OEM but you can also run the dbms_sqltune package
to run the SQL Tuning Advisor from the command line.
This approach is often better than the GUI of Oracle
Enterprise Manager because the SQL*Plus command line gives
you complete control over the dbms_sqltune procedures.
Here are some notes that explain the use of the SQL Tuning
advisor from the command line:
Running the SQL tuning advisor from the command line with
- Run the
SQL performance analyzer from the command line
SQL Statements from cursor cache, AWR, and custom
workload can be filtered and/or ranked before they are input
to the SQL Tuning Advisor.
In the second stage, execute the tuning analysis tasks
and view the results (or create the SQL profiles). Later,
you can implement the suggestions.
Oracle Enterprise manager is a good place to launch and
utilize the SQL Tuning Advisor. SQL Tuning Advisor GUI can
be invoked at multiple places within the OEM.
- For high-load SQL statements identified by ADDM, SQL
Tuning Advisor can be launched from the ADDM Finding
- When selecting from the Top SQL statements, Advisor
can be launched from the Top SQL Page.
- When STS becomes the input for tuning, advisor can
be launched from the SQL Tuning Sets page.
OEM also allows you to view the tuning analysis results,
create the SQL profile, and then implement the suggestions.
In addition to the OEM GUI, SQL Advisor functionality can
be obtained by using the PL/SQL package dbms_sqltune. This
is a new package introduced in 10g, and it has comprehensive
procedures that help to conduct the full SQL Advisor
session. Some of the useful procedures include:
- create_tuning_task - Creates a tuning task for a
given SQL statement or for a cached cursor
- execute_tuning_task – Executes the tuning task and
generates the tuning data
- report_tuning_task – Generates a complete report of
the results of a task
- report_plans – Shows the SQL plans
There are two important initialization parameters that
affect the operation of SQL Tuning Advisor. They are as
- optimizer_auto_learn –Enables or disables the
auto-learning optimizer feature
- sqltune_category – Selectively enables the SQL
tuning base features for specific sessions
Note: You must purchase an
extra-cost license (Enterprise Edition plus the Diagnostics
pack and Tuning pack) from Oracle, to run the dbms_sqltune
Oracle Training from Don Burleson
The best on site
training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!
Burleson is the American Team
documentation was created as a support and Oracle training reference for use by our
DBA performance tuning consulting professionals.
Feel free to ask questions on our
considering using the services of an Oracle support expert should
independently investigate their credentials and experience, and not rely on
advertisements and self-proclaimed expertise. All legitimate Oracle experts
Oracle technology is changing and we
strive to update our BC Oracle support information. If you find an error
or have a suggestion for improving our content, we would appreciate your
and include the URL for the page.
Copyright © 1996 - 2016
All rights reserved by
is the registered trademark of Oracle Corporation.