Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







SQL Tuning Advisor using command line utilities

Oracle Database Tips by Donald BurlesonJune 5, 2016

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 dbms_sqltune

- Using report_sql_monitor.

- 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 Details screen.
  • 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 follows:

  • 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 package.

Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training

  Oracle consulting and training


Burleson is the American Team

Note: This Oracle 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 Oracle forum.

Verify experience! Anyone 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 publish their Oracle qualifications.

Errata?  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 feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster