Call now: 252-767-6166  
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 


 

 

 


 

 

 
 

Tuning vendor SQL tricks

Oracle Database Tips by Donald BurlesonFebruary 10, 2015

 

Question:  I just bought a vendor application and I need to change the execution plans for the SQL.  The vendor will not help, and I need to know how to modify SQL explain plans without touching the vendor source SQL statements.

Answer:  This is a common problem, and it's addressed in the eBook Tuning Third-Party Oracle Vendor Systems.  I also have some good notes on tuning Oracle vendor applications.

There are three ways to change SQL execution plans for packages vendor applications where you cannot modify the source code:

  • Swap stored outlines:  You can swap stored outlines and change the execution plan for a SQL statement.

  • SQL Profiles:  For Oracle 10g and beyond, you can tune SQL remotely by swapping SQL Profiles.

  • The dbms_sqldiag_internal package:  See dbms_sqldiag_internal.

In general, there are several methods to swap-out a bad execution plan with a tuned execution plan, and the approach depends on your release level of Oracle:

Swapping stored Outlines

 MOSC note 92202 .1 describes a procedure to tune SQL that you cannot touch by performing these steps:

  1. Identify the sub-optimal SQL and create a stored outline

  2. Tune an equivalent query with a faster execution plan and create a stored outline

  3. Swap the bad stored outline for the tuned stored outline

Oracle provides this example for swapping the outlines:

UPDATE
   OUTLN.OL$HINTS
SET
   OL_NAME=DECODE 
     (OL_NAME,'HINTSQL','ORIGINALSQL','ORIGINALSQL','HINTSQL')
WHERE
   OL_NAME IN ('HINTSQL','ORIGINALSQL');
Commit;

SQL Profiles

The Oracle 10g automatic tuning advisor allowed us to implement tuning suggestions in the form of SQL profiles that will improve performance, and SQL profiles can be used the same way as stored outlines (optimizer plan stability). 

A SQL Profile is stored persistently in the data dictionary, so it does not require any application code changes.

A SQL profile helps generate a better execution plan than the normal optimization because it can be validated against a real-world workload in the SQL Tuning Set (STS). Additional tasks like checking for advanced predicate selectivity, correlation between columns, join skews, and complex predicates such as functions, help in profiling the SQL statement. Once a SQL statement is profiled and stored, differing execution plans can be invoked at will.

For a full discussion and examples, see my notes on swapping SQL Profiles.

SQL Performance Analyzer (SPA)

In Oracle 11g, we see the SQL Performance Analyzer, a holistic tool that allows the DBA to test Silver Bullet settings (system-wide parms, changes to CBO stats) against a real-world workload.  In 11g,

Now with Oracle11g, the DBA can tell Oracle to automatically apply SQL profiles for statements whenever the suggested profile give 3-times better performance that the existing statement. These performance comparisons are done by a new 11g administrative task that is executed during a user-specified maintenance window. 
 

If you like Oracle tuning, you might enjoy my book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


 

 

��  
 
 
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.