Oracle Training Oracle Support Development Oracle Apps

 
 Home
 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
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

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

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

        
 

 SQL*Plus AUTOTRACE plustrc tips

Sometimes the explain plan by itself does not provide sufficient information because although there is now an idea of the procedural logic or algorithm used to process the query, the plan itself does not provide any realistic work execution context or background by which to measure.

 

How can one actually tell if a full table scan is really better than an indexed search if the work actual performed for each is unknown? What is needed is an extended "explain plan" capability - one where both the estimated algorithm and its net resulting workload are displayed. Fortunately, Oracle has built that exact feature into SQL*Plus, and it is one of the most useful ways to work with and/or measure explain plan effectiveness. It is called SQL*Plus AUTOTRACE.

 

SQL*Plus AUTOTRACE requires some initial setup before it can be used, much like explain plans, meaning that some scripts need to be run. The user must be granted a special role known as PLUSTRC in order to use AUTOTRACE, or they will see the error message shown here:

 

Figure 5.9:  Error Message without PLUSTRC

In order to setup AUTOTRACE, the DBA must perform the following two steps. First, they must run the $ORACLE_HOME/sqlplus/admin/plustrce.sql script shown below to create the PLUSTRACE role. Then that PLUSTRACE role simply needs to be granted as a default enabled role to any users who want to utilize this facility.

 

plustrce.sql script

 

set echo on

 

drop role plustrace;

create role plustrace;

 

grant select on v_$sesstat to plustrace;

grant select on v_$statname to plustrace;

grant select on v_$mystat to plustrace;

grant plustrace to dba with admin option;

 

set echo off

 

Once the proper setup steps have been completed, there is now a much improved explain plan output, one with both the estimated algorithm and the actual work performed to run it as shown in Figure 5.10. The SQL*Plus user merely has to include a SET AUTOTRACE ON command. Now information can be received about the actual work performs like logical reads, physical reads, sorts and such.

 

Figure 5. 10:  
SQL*Plus Auto-Trace Output

 

Note: Although the SQL*Plus AUTOTRACE facility is easy to use and generates a lot of useful information, the DBA or developer can gather much more detailed information via the session level trace facility. This is a quick and dirty approach. When better information is needed, favor session-level trace output.



Fo
r more details on Oracle utilities, see the book "Advanced Oracle Utilities" by Bert Scalzo, Donald K. Burleson, and Steve Callan.

You can buy it direct from the publisher for 30% off directly fromRampant TechPress.


     

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

 

   

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.