My Oracle Support Banner

Worked Example of Replacing the Current Existing Plan with a Different Plan Using a SPM SQL Plan Baseline (Doc ID 1580762.1)

Last updated on NOVEMBER 07, 2023

Applies to:

Oracle Database - Enterprise Edition - Version and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Information in this document applies to any platform.


NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

Please also note that SPM cannot be used in Standard Edition.

In a situation where you want to use a different access path for a query but you can not modify the application SQL, you can enforce the plan by using SQL Plan Management (SPM) baselines. This article provides a worked example of the steps required to achieve this.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document
 Worked Example:
 Setup tables for the example:
 Load data into the tables
 Execute the Original SQL
 Get the SQL_ID for the Original SQL
 Load the SQL to baseline
 Check to see the SQL is in baseline
 Disable the SQL in baseline
 Check to see that the baseline is disabled
 Run the SQL with the target access path
 Identify the SQL using the target plan
 Associate the target plan with the Query
 Check baseline
 Test that the original SQL runs serially

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.