SlideShare a Scribd company logo
1 of 59
Download to read offline
REMINDER
Check in on the
COLLABORATE mobile app
Stabilize Your Plans with SQL Plan
Management Including 12c
Prepared by:
Alfredo Krieg
Sr. Oracle Cloud Administrator
The Sherwin-Williams Company
Session ID#: 231
@alfredokrieg
Stabilize Your Plans with SQL
Plan Management Including 12c
SPM 12c
Last session!!
Who am I?
■ Alfredo Krieg (Alfredo.Krieg.Villa@sherwin.com)
■ Senior Oracle Enterprise Cloud Administrator at The Sherwin-
Williams Company based in Cleveland, OH
■ Oracle ACE Associate
■ OEM Cloud Control 12c and Database Performance Tuning
■ Oracle Technologies since 2004 & 11g Certified
■ Blog bitkode.blogspot.com
The Sherwin-Williams Company
■ Largest Producer of Paint & Coatings in US, among Top 3 worldwide
■ Founded in 1866 in Cleveland, OH
■ 2016 is 150th Anniversary
■ 2013 - $10.19 billion in sales
■ Business in 120+ Countries
■ 34,000+ employees
■ 4,000+ Company Owned Stores
■ 90+ Manufacturing Facilities Globally
The Sherwin-Williams Company
The Sherwin-Williams Company was founded by
Henry Sherwin and Edward Williams in 1866.
Today, we are global leader in the manufacture,
development, distribution and sale of coatings and related
products to professional, industrial, commercial and retail
customers.
The Company manufactures products under well-known brands such as
Sherwin-Williams®, Dutch Boy®, Krylon®, Minwax®, Thompson’s®
Water Seal® and many more. With global headquarters in Cleveland,
Ohio, Sherwin-Williams® branded products are sold exclusively through
more than 4,000 company-operated stores and facilities, while the
Company’s other brands are sold through leading mass merchandisers,
home centers, hardware stores, automotive retailers and industrial
distributors.
www.sherwin-williams.com
Motivation
■ Performance problem on a critical SQL statement
■ Users claim that this SQL has been place for a long period of time
■ Developers claim they haven’t made any changes to the SQL
■ You are responsible of making that SQL run with acceptable
performance
■ Sometimes(?) the problem is reported at 1 am in the morning or
Friday 5 pm
Agenda
■ SPM Framework
- How the SPM framework works
- Plan flexibility VS Plan stability
■ Setup SPM
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
■ Easy SPM Use With OEM 12c
- Use OEM 12c Cloud Control to easy the use of SPM
■ SPM Advanced Administration
- SPM trace
SPM Framework
■ Cost Based Optimizer CBO (since Oracle 7)
▪ Determines the most efficient way to execute a SQL statement
after considering:
— Parameters
— Statistics
— Others (Hints, Outlines, Index Selectivity, etc.)
▪ Produces an optimal execution plan most of the times
▪ Setup CBO to where most SQL plans are optimal
▪ We want the CBO to be flexible enough to produce optimal
plans as needed
SPM Framework
■ Plan Flexibility Vs Plan Stability
▪ Flexibility
— Goal is to allow the CBO to produce plans
(optimal/suboptimal)
— CBO Statistics and Histograms, Parameters, Bind Peeking,
Cardinality Feedback CFB, Adaptive Cursor Sharing, SQL
profiles STA
— Expect execution plan changes
http://bitkode.blogspot.com/2013/05/why-execution-plan-changed-
case-study.html
▪ Stability
— Goal is to allow only optimal plans to be executed
— Outlines, Hints, SQL Plan Management, Custom SQL
profiles SQLT
SPM Framework
EMPLOYEE
CREATE INDEX STATE_ID_IDX
ON EMPLOYEE (STATE_ID);
VARIABLE A NUMBER;
EXEC :A := 5;
SELECT NAME FROM EMPLOYEE
WHERE STATE_ID = :A;
EXEC :A := 1;
SELECT NAME FROM EMPLOYEE
WHERE STATE_ID = :A;
INDEX
SCAN?
FULL TABLE
SCAN?
SPM Framework
■ SQL Plan Management
▪ New feature in 11g+ for plan stability and control
▪ Only selected plans (Accepted and Enabled) are executed
▪ New plans are captured and stored but not executed (default)
■ SQL Plan Control Flags
▪ Enabled (YES/NO)
— Either alive or deleted
▪ Accepted (YES/NO)
— If Enabled and Accepted will be executed; if not Accepted
can be Evolved
▪ Fixed (YES/NO) “only if accepted and enabled”
— Plans have priority over Accepted plans and are not
expected to change
SPM Framework
■ SQL Plan Baseline
▪ Group/Set of Accepted plans
■ Plan History
▪ Group/Set of Accepted and not-Accepted plans
■ Plan Evolution
▪ Process of making Enabled plans Accepted
■ SQL Management Base
▪ Set of database objects that store Plan History, SQL Plan
Baseline and SQL Profiles
SPM Framework
■ SQL Plan Management Views
▪ DBA_SQL_PLAN_BASELINES & V$SQL
SPM Framework
■ Signature
▪ Unique SQL identifier (hash) from the normalized SQL text
(uncased and whitespaces removed)
— DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE
■ SQL Plan Status Flags
▪ Reproduced (YES/NO)
— CBO can or cannot reproduce the plan
▪ Autopurge (YES/NO)
— If YES the plan will be purged if not used, NO never purged
▪ Rejected (YES/NO)
— Plan was Unaccepted (Accepted = NO) & has
LAST_VERIFIED date or ENABLED=NO
SPM Framework
■ SQL Plan Management Initialization Parameters
▪ OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES
— FALSE by default. Controls the automatic creation of SQL
plan baselines
▪ OPTIMIZER_USE_SQL_PLAN_BASELINES
— TRUE by default. Controls the use of SQL plan baselines
SPM Framework
■ SQL Plan Management has three main components
▪ Plan Capture
— Automatic Plan Capture
— Manual Plan Capture
▪ Plan Selection
▪ Plan Evolution
— Automatic Plan Evolution
— Manual Plan Evolution
Agenda
■ SPM Framework
- How the SPM framework works
- Plan flexibility VS Plan stability
■ Setup SPM
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
■ Easy SPM Use With OEM 12c
- Use OEM 12c Cloud Control to easy the use of SPM
■ SPM Advanced Administration
- SPM trace
Setup SPM – Plan Capture
■ Automatic Plan Capture
▪ OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES = TRUE
▪ More than one SQL execution
Setup SPM – Plan Capture
■ Manual Plan Capture
▪ Most common method to capture plans
▪ PL/SQL package DBMS_SPM or Enterprise Manager 12c
▪ Four different sources
— Cursor Cache
— SQL Tuning Set
— Stored Outlines
— Another DB System
▪ Loaded plans are automatically Accepted
Setup SPM – Plan Capture
■ Manual Plan Capture
Setup SPM – Plan Capture
■ Manual Plan Capture
Setup SPM – Plan Capture
■ Manual Plan Capture
Setup SPM – Plan Selection
■ OPTIMIZER_USE_SQL_PLAN_BASELINES=TRUE (Default)
Setup SPM – Plan Evolution
■ Accept or reject plans
▪ Automatic Plan Evolution
— SQL Tuning Advisor task (11g)
— SPM Evolve Advisor (SYS_AUTO_SPM_EVOLVE_TASK)
(12c)
▪ Manual Plan Evolution
— DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE function
(11gR2)
— SPM Evolve Advisor API (12c)
• DBMS_SPM.CREATE_EVOLVE_TASK
• DBMS_SPM.EXECUTE_EVOLVE_TASK
• DBMS_SPM.REPORT_EVOLVE_TASK
• DBMS_SPM.ACCEPT_SQL_PLAN_BASELINE
Setup SPM – Plan Evolution
■ Adaptive SQL Plan Management – Automatic Plan Evolution (12c)
▪ Enabled by default
▪ When automatic SQL tuning is in COMPREHENSIVE mode, it
runs a verification or evolve process for all SQL statements that
have non-accepted plans during the nightly maintenance
window.
▪ If the non-accepted plan performs better (1.5x default) than the
existing accepted plan (or plans) in the SQL plan baseline, then
the plan is automatically accepted and becomes usable by the
optimizer.
▪ After the task is complete, a persistent report is generated
detailing how the non-accepted plan performs compared to the
accepted plan performance.
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ 11gR1
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ Display execution plans for a baseline
▪ Parameters:
— sql_handle =>
— plan_name =>
— format => ‘BASIC’, ‘TYPICAL’ & ‘ALL’
Setup SPM – Plan Evolution
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ 11gR2
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ 11gR2
▪ VERIFY (YES/NO) compare the performance before changing
non-accepted plans into accepted plans
— When set to 'YES', the non-accepted plan(s) will be accepted
if verified to give better performance
— When set to 'NO', the non-accepted plan(s) will be changed
to accepted plan(s). (11gR1 like)
▪ COMMIT (YES/NO)
— When set to 'YES', baseline will be updated to ACCEPTED
status and a report will be generated
— When set to 'NO', a report will be generated without actually
changing the status of the baseline(s) to ACCEPTED.
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ 12c
▪ Create evolve task
▪ Execute evolve task
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ Generate report
▪ Manual execution of SPM EVOLVE ADVISOR does NOT
accept any sql plan baseline!!
Setup SPM – Plan Evolution
■ Manual Plan Evolution
▪ Accept the plan baseline recommended by the advisor
▪ If you try to accept the plan baseline which is NOT
recommended by SPM EVOLVE ADVISOR, it will fail
with ORA-38149.
▪ You can accept the plan baseline which is NOT recommended
by SPM EVOLVE ADVISOR, by setting force to TRUE.
▪ How to Manually Evolve and Accept SQL PLAN BASELINES in
Oracle 12c (Doc ID 1939828.1)
Setup SPM – Plan Evolution
■ Reject Plans
▪ 11gR1
Setup SPM – Plan Evolution
■ Reject Plans
▪ 11gR2 & 12c
Setup SPM
■ Pack, Load and Unpack baselines
▪ 1. On the original system, create a staging table using the
DBMS_SPM.CREATE_STGTAB_BASELINE procedure
▪ 2. Pack the SQL plan baselines you want to export from the
SQL management base into the staging table using the
DBMS_SPM.PACK_STGTAB_BASELINE function.
▪ 3. Export the staging table into a flat file using the export
command or Oracle Data Pump.
▪ 4. Transfer this flat file to the target system.
▪ 5. Import the staging table from the flat file using the import
command or Oracle Data Pump.
▪ 6. Unpack the SQL plan baselines from the staging table into
the SQL management base on the target system using the
DBMS_SPM.UNPACK_STGTAB_BASELINE function.
Setup SPM
Agenda
■ SPM Framework
- How the SPM framework works
- Plan flexibility VS Plan stability
■ Setup SPM
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
■ Easy SPM Use With OEM 12c
- Use OEM 12c Cloud Control to easy the use of SPM
■ SPM Advanced Administration
- SPM trace
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Easy SPM Use With OEM 12c
Agenda
■ SPM Framework
- How the SPM framework works
- Plan flexibility VS Plan stability
■ Setup SPM
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
■ Easy SPM Use With OEM 12c
- Use OEM 12c Cloud Control to easy the use of SPM
■ SPM Advanced Administration
- SPM trace
SPM Administration
■ SPM Trace Doc ID 789520.1
▪ Issues where the baseline is expected to reproduce a specific
plan, but does not work as expected
▪ Issues with the creation or manipulation of baselines
▪ SRDC - How to Collect Standard Information for an Issue
Where a SQL Plan Management (SPM) Baseline is Not Used
(Doc ID 1644732.1)
ENABLE
DISABLE
SPM Administration
■ SPM Trace Doc ID 789520.1
Open an SR with Oracle Support
and provide the trace file
SPM Administration
■ SPM Plan Retention
▪ Weekly scheduled task that runs as an automated task in the
maintenance window
▪ Purges plans that have not been used for longer than the plan
retention period
▪ Default retention is 53 weeks and can be setup from 5 to 523
weeks
SPM Administration
■ Manage SBM space limit
▪ Weekly background process measures the total space
occupied by the SMB in the SYSAUX tablespace, default 10%
▪ Process writes a warning message to the alert log
▪ Fix by increase SBM space limit, increase SYSAUX size or
purge baselines
SPM Administration
■ Licensing
▪ SPM is available as part of Oracle Database Enterprise Edition
▪ Includes any of the DBMS_SPM procedures
■ But, below features require the Tuning Pack
▪ Automatic Plan Evolution for SQL Plan Management STA
▪ Load plans from SQL Tuning Sets into SPM, STS can only be
created if you have Tuning pack or RAT pack
■ Maria Colgan’s Blog
https://blogs.oracle.com/optimizer/entry/does_the_use_of_sql
SPM Administration
SPM Administration
■ Acceptance threshold in the evolve process
▪ Controlled by hidden parameter
▪ How to Evolve a SQL Plan Baseline and Adjust the
Acceptance Threshold (Doc ID 1617790.1)
More?
■ Where to Find Information About Performance Related Features
(Doc ID 1361401.1)
■ Database SQL Tuning Guide
https://docs.oracle.com/database/121/TGSQL/tgsql_spm.htm#TG
SQL94621
■ SQL Plan Management 11g
http://www.oracle.com/technetwork/database/bi-
datawarehousing/twp-sql-plan-management-11gr2-133099.pdf
■ SQL Plan Management 12c
http://www.oracle.com/technetwork/database/bi-
datawarehousing/twp-sql-plan-mgmt-12c-1963237.pdf
Please complete the session
evaluation
We appreciate your feedback and insight
You may complete the session evaluation either
on paper or online via the mobile app

More Related Content

What's hot

Exploring plsql new features best practices september 2013
Exploring plsql new features best practices   september 2013Exploring plsql new features best practices   september 2013
Exploring plsql new features best practices september 2013Andrejs Vorobjovs
 
Oracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationOracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationFrancisco Alvarez
 
Anatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business SuiteAnatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business Suitevasuballa
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracleTrainings
 
Microsoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMicrosoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMark Ginnebaugh
 
Oracle Exadata Management with Oracle Enterprise Manager
Oracle Exadata Management with Oracle Enterprise ManagerOracle Exadata Management with Oracle Enterprise Manager
Oracle Exadata Management with Oracle Enterprise ManagerEnkitec
 
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...Ajith Narayanan
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellEmily Ikuta
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationBerry Clemens
 
Release and patching strategy
Release and patching strategyRelease and patching strategy
Release and patching strategyJitendra Singh
 
Autoconfig r12
Autoconfig r12Autoconfig r12
Autoconfig r12techDBA
 
C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...
C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...
C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...Maris Elsins
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsSrinivasa Pavan Marti
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerAndrejs Vorobjovs
 
SAP HANA Dynamic Tiering Test-drive
SAP HANA Dynamic Tiering Test-driveSAP HANA Dynamic Tiering Test-drive
SAP HANA Dynamic Tiering Test-driveLinh Nguyen
 
Sap basis-transaction-codes
Sap basis-transaction-codesSap basis-transaction-codes
Sap basis-transaction-codesKarthikN157
 
R12.2.5 new features
R12.2.5 new featuresR12.2.5 new features
R12.2.5 new featuresTahirGhafoor
 

What's hot (20)

Oracle Enterprise Manager 11g
Oracle Enterprise Manager 11gOracle Enterprise Manager 11g
Oracle Enterprise Manager 11g
 
Exploring plsql new features best practices september 2013
Exploring plsql new features best practices   september 2013Exploring plsql new features best practices   september 2013
Exploring plsql new features best practices september 2013
 
Oracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c PresentationOracle Enterprise Manager 12c - OEM12c Presentation
Oracle Enterprise Manager 12c - OEM12c Presentation
 
Oracle Enterprise Manager
Oracle Enterprise ManagerOracle Enterprise Manager
Oracle Enterprise Manager
 
Anatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business SuiteAnatomy of Autoconfig in Oracle E-Business Suite
Anatomy of Autoconfig in Oracle E-Business Suite
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance Tuning
 
Microsoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMicrosoft SQL Server Query Tuning
Microsoft SQL Server Query Tuning
 
Oracle Exadata Management with Oracle Enterprise Manager
Oracle Exadata Management with Oracle Enterprise ManagerOracle Exadata Management with Oracle Enterprise Manager
Oracle Exadata Management with Oracle Enterprise Manager
 
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...
 
MySQL 5.7 in a Nutshell
MySQL 5.7 in a NutshellMySQL 5.7 in a Nutshell
MySQL 5.7 in a Nutshell
 
Getting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentationGetting optimal performance from oracle e-business suite presentation
Getting optimal performance from oracle e-business suite presentation
 
Release and patching strategy
Release and patching strategyRelease and patching strategy
Release and patching strategy
 
Autoconfig r12
Autoconfig r12Autoconfig r12
Autoconfig r12
 
C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...
C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...
C15LV: Ins and Outs of Concurrent Processing Configuration in Oracle e-Busine...
 
E business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administratorsE business suite r12.2 changes for database administrators
E business suite r12.2 changes for database administrators
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource Manager
 
SAP HANA Dynamic Tiering Test-drive
SAP HANA Dynamic Tiering Test-driveSAP HANA Dynamic Tiering Test-drive
SAP HANA Dynamic Tiering Test-drive
 
Enterprise manager 13c
Enterprise manager 13cEnterprise manager 13c
Enterprise manager 13c
 
Sap basis-transaction-codes
Sap basis-transaction-codesSap basis-transaction-codes
Sap basis-transaction-codes
 
R12.2.5 new features
R12.2.5 new featuresR12.2.5 new features
R12.2.5 new features
 

Similar to Oracle SPM 12c. IOUG #C15LV

In Search of Plan Stability Part 2 with Karen Morton
In Search of Plan Stability Part 2 with Karen MortonIn Search of Plan Stability Part 2 with Karen Morton
In Search of Plan Stability Part 2 with Karen MortonEmbarcadero Technologies
 
Oracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPMOracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPMArturo Aranda
 
SAP ASE Migration Lessons Learned
SAP ASE Migration Lessons LearnedSAP ASE Migration Lessons Learned
SAP ASE Migration Lessons LearnedAliter Consulting
 
SAP ASE Migration Lessons Learned
SAP ASE Migration Lessons LearnedSAP ASE Migration Lessons Learned
SAP ASE Migration Lessons LearnedGary Jackson MBCS
 
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityLVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityMaris Elsins
 
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityEnkitec
 
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan StabilityCarlos Sierra
 
Con8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentAnil Nair
 
GoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12c
GoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12cGoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12c
GoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12cMichael Rainey
 
LVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11gLVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11gMaris Elsins
 
D73549GC10_06.pptx
D73549GC10_06.pptxD73549GC10_06.pptx
D73549GC10_06.pptxVLQuyNhn
 
Oracle RAC BP for Upgrade & More by Anil Nair and Markus Michalewicz
Oracle RAC BP for Upgrade & More by Anil Nair and Markus MichalewiczOracle RAC BP for Upgrade & More by Anil Nair and Markus Michalewicz
Oracle RAC BP for Upgrade & More by Anil Nair and Markus MichalewiczMarkus Michalewicz
 
Performance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresJitendra Singh
 
Optimizing E-Business Suite Storage Using Oracle Advanced Compression
Optimizing E-Business Suite Storage Using Oracle Advanced CompressionOptimizing E-Business Suite Storage Using Oracle Advanced Compression
Optimizing E-Business Suite Storage Using Oracle Advanced CompressionAndrejs Karpovs
 
SAP HANA SPS10- SQLScript
SAP HANA SPS10- SQLScriptSAP HANA SPS10- SQLScript
SAP HANA SPS10- SQLScriptSAP Technology
 

Similar to Oracle SPM 12c. IOUG #C15LV (20)

In Search of Plan Stability Part 2 with Karen Morton
In Search of Plan Stability Part 2 with Karen MortonIn Search of Plan Stability Part 2 with Karen Morton
In Search of Plan Stability Part 2 with Karen Morton
 
11gR2 Upgrade.pdf
11gR2 Upgrade.pdf11gR2 Upgrade.pdf
11gR2 Upgrade.pdf
 
11gR2 Upgrade.pdf
11gR2 Upgrade.pdf11gR2 Upgrade.pdf
11gR2 Upgrade.pdf
 
Oracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPMOracle DB 19c: SQL Tuning Using SPM
Oracle DB 19c: SQL Tuning Using SPM
 
SAP ASE Migration Lessons Learned
SAP ASE Migration Lessons LearnedSAP ASE Migration Lessons Learned
SAP ASE Migration Lessons Learned
 
SAP ASE Migration Lessons Learned
SAP ASE Migration Lessons LearnedSAP ASE Migration Lessons Learned
SAP ASE Migration Lessons Learned
 
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan InstabilityLVOUG meetup #2 - Forcing SQL Execution Plan Instability
LVOUG meetup #2 - Forcing SQL Execution Plan Instability
 
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to Balance Plan Flexibility and Plan Stability
 
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan StabilityUsing SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
Using SQL Plan Management (SPM) to balance Plan Flexibility and Plan Stability
 
Con8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2contentCon8780 nair rac_best_practices_final_without_12_2content
Con8780 nair rac_best_practices_final_without_12_2content
 
Rohit_Panot
Rohit_PanotRohit_Panot
Rohit_Panot
 
GoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12c
GoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12cGoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12c
GoldenGate and Oracle Data Integrator - A Perfect Match- Upgrade to 12c
 
LVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11gLVOUG meetup #4 - Case Study 10g to 11g
LVOUG meetup #4 - Case Study 10g to 11g
 
D73549GC10_06.pptx
D73549GC10_06.pptxD73549GC10_06.pptx
D73549GC10_06.pptx
 
Oracle RAC BP for Upgrade & More by Anil Nair and Markus Michalewicz
Oracle RAC BP for Upgrade & More by Anil Nair and Markus MichalewiczOracle RAC BP for Upgrade & More by Anil Nair and Markus Michalewicz
Oracle RAC BP for Upgrade & More by Anil Nair and Markus Michalewicz
 
Performance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and UnderscoresPerformance Stability, Tips and Tricks and Underscores
Performance Stability, Tips and Tricks and Underscores
 
High availability disaster recovery 101
High availability   disaster recovery 101High availability   disaster recovery 101
High availability disaster recovery 101
 
Optimizing E-Business Suite Storage Using Oracle Advanced Compression
Optimizing E-Business Suite Storage Using Oracle Advanced CompressionOptimizing E-Business Suite Storage Using Oracle Advanced Compression
Optimizing E-Business Suite Storage Using Oracle Advanced Compression
 
CV_SAP_BASIS_Noufal
CV_SAP_BASIS_NoufalCV_SAP_BASIS_Noufal
CV_SAP_BASIS_Noufal
 
SAP HANA SPS10- SQLScript
SAP HANA SPS10- SQLScriptSAP HANA SPS10- SQLScript
SAP HANA SPS10- SQLScript
 

More from Alfredo Krieg

Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13cClone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13cAlfredo Krieg
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportAlfredo Krieg
 
Simplifying EBS 12.2 ADOP - Collaborate 2019
Simplifying EBS 12.2 ADOP - Collaborate 2019   Simplifying EBS 12.2 ADOP - Collaborate 2019
Simplifying EBS 12.2 ADOP - Collaborate 2019 Alfredo Krieg
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new featuresAlfredo Krieg
 
Where did my day go?: Oracle Enterprise Manager 12c/13c Administration
Where did my day go?: Oracle Enterprise Manager 12c/13c AdministrationWhere did my day go?: Oracle Enterprise Manager 12c/13c Administration
Where did my day go?: Oracle Enterprise Manager 12c/13c AdministrationAlfredo Krieg
 
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...Alfredo Krieg
 
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUG
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUGWhere did my day go?: OEM 12c Administration #em12c #C15LV @IOUG
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUGAlfredo Krieg
 
Oracle database performance are database users telling me the truth
Oracle database performance are database users telling me the truthOracle database performance are database users telling me the truth
Oracle database performance are database users telling me the truthAlfredo Krieg
 
553: Oracle Database Performance: Are Database Users Telling Me The Truth?
553: Oracle Database Performance: Are  Database Users Telling Me The Truth?553: Oracle Database Performance: Are  Database Users Telling Me The Truth?
553: Oracle Database Performance: Are Database Users Telling Me The Truth?Alfredo Krieg
 

More from Alfredo Krieg (9)

Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13cClone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR Report
 
Simplifying EBS 12.2 ADOP - Collaborate 2019
Simplifying EBS 12.2 ADOP - Collaborate 2019   Simplifying EBS 12.2 ADOP - Collaborate 2019
Simplifying EBS 12.2 ADOP - Collaborate 2019
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new features
 
Where did my day go?: Oracle Enterprise Manager 12c/13c Administration
Where did my day go?: Oracle Enterprise Manager 12c/13c AdministrationWhere did my day go?: Oracle Enterprise Manager 12c/13c Administration
Where did my day go?: Oracle Enterprise Manager 12c/13c Administration
 
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...
 
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUG
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUGWhere did my day go?: OEM 12c Administration #em12c #C15LV @IOUG
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUG
 
Oracle database performance are database users telling me the truth
Oracle database performance are database users telling me the truthOracle database performance are database users telling me the truth
Oracle database performance are database users telling me the truth
 
553: Oracle Database Performance: Are Database Users Telling Me The Truth?
553: Oracle Database Performance: Are  Database Users Telling Me The Truth?553: Oracle Database Performance: Are  Database Users Telling Me The Truth?
553: Oracle Database Performance: Are Database Users Telling Me The Truth?
 

Recently uploaded

Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08LloydHelferty
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitysandeepnani2260
 
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptxerickamwana1
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxRoquia Salam
 
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...soumyapottola
 
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityDon't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityApp Ethena
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per MVidyaAdsule1
 
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Sebastiano Panichella
 
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...Sebastiano Panichella
 
Scootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City DeliveryScootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City Deliveryrishi338139
 

Recently uploaded (11)

Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
Sunlight Spectacle 2024 Practical Action Launch Event 2024-04-08
 
GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024GESCO SE Press and Analyst Conference on Financial Results 2024
GESCO SE Press and Analyst Conference on Financial Results 2024
 
cse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber securitycse-csp batch4 review-1.1.pptx cyber security
cse-csp batch4 review-1.1.pptx cyber security
 
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
05.02 MMC - Assignment 4 - Image Attribution Lovepreet.pptx
 
Application of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptxApplication of GIS in Landslide Disaster Response.pptx
Application of GIS in Landslide Disaster Response.pptx
 
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
Understanding Post Production changes (PPC) in Clinical Data Management (CDM)...
 
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunityDon't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
Don't Miss Out: Strategies for Making the Most of the Ethena DigitalOpportunity
 
General Elections Final Press Noteas per M
General Elections Final Press Noteas per MGeneral Elections Final Press Noteas per M
General Elections Final Press Noteas per M
 
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
 
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...Testing with Fewer Resources:  Toward Adaptive Approaches for Cost-effective ...
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
 
Scootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City DeliveryScootsy Overview Deck - Pan City Delivery
Scootsy Overview Deck - Pan City Delivery
 

Oracle SPM 12c. IOUG #C15LV

  • 1. REMINDER Check in on the COLLABORATE mobile app Stabilize Your Plans with SQL Plan Management Including 12c Prepared by: Alfredo Krieg Sr. Oracle Cloud Administrator The Sherwin-Williams Company Session ID#: 231 @alfredokrieg
  • 2. Stabilize Your Plans with SQL Plan Management Including 12c SPM 12c
  • 4. Who am I? ■ Alfredo Krieg (Alfredo.Krieg.Villa@sherwin.com) ■ Senior Oracle Enterprise Cloud Administrator at The Sherwin- Williams Company based in Cleveland, OH ■ Oracle ACE Associate ■ OEM Cloud Control 12c and Database Performance Tuning ■ Oracle Technologies since 2004 & 11g Certified ■ Blog bitkode.blogspot.com
  • 5. The Sherwin-Williams Company ■ Largest Producer of Paint & Coatings in US, among Top 3 worldwide ■ Founded in 1866 in Cleveland, OH ■ 2016 is 150th Anniversary ■ 2013 - $10.19 billion in sales ■ Business in 120+ Countries ■ 34,000+ employees ■ 4,000+ Company Owned Stores ■ 90+ Manufacturing Facilities Globally
  • 6. The Sherwin-Williams Company The Sherwin-Williams Company was founded by Henry Sherwin and Edward Williams in 1866. Today, we are global leader in the manufacture, development, distribution and sale of coatings and related products to professional, industrial, commercial and retail customers. The Company manufactures products under well-known brands such as Sherwin-Williams®, Dutch Boy®, Krylon®, Minwax®, Thompson’s® Water Seal® and many more. With global headquarters in Cleveland, Ohio, Sherwin-Williams® branded products are sold exclusively through more than 4,000 company-operated stores and facilities, while the Company’s other brands are sold through leading mass merchandisers, home centers, hardware stores, automotive retailers and industrial distributors. www.sherwin-williams.com
  • 7. Motivation ■ Performance problem on a critical SQL statement ■ Users claim that this SQL has been place for a long period of time ■ Developers claim they haven’t made any changes to the SQL ■ You are responsible of making that SQL run with acceptable performance ■ Sometimes(?) the problem is reported at 1 am in the morning or Friday 5 pm
  • 8. Agenda ■ SPM Framework - How the SPM framework works - Plan flexibility VS Plan stability ■ Setup SPM - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines ■ Easy SPM Use With OEM 12c - Use OEM 12c Cloud Control to easy the use of SPM ■ SPM Advanced Administration - SPM trace
  • 9. SPM Framework ■ Cost Based Optimizer CBO (since Oracle 7) ▪ Determines the most efficient way to execute a SQL statement after considering: — Parameters — Statistics — Others (Hints, Outlines, Index Selectivity, etc.) ▪ Produces an optimal execution plan most of the times ▪ Setup CBO to where most SQL plans are optimal ▪ We want the CBO to be flexible enough to produce optimal plans as needed
  • 10. SPM Framework ■ Plan Flexibility Vs Plan Stability ▪ Flexibility — Goal is to allow the CBO to produce plans (optimal/suboptimal) — CBO Statistics and Histograms, Parameters, Bind Peeking, Cardinality Feedback CFB, Adaptive Cursor Sharing, SQL profiles STA — Expect execution plan changes http://bitkode.blogspot.com/2013/05/why-execution-plan-changed- case-study.html ▪ Stability — Goal is to allow only optimal plans to be executed — Outlines, Hints, SQL Plan Management, Custom SQL profiles SQLT
  • 11. SPM Framework EMPLOYEE CREATE INDEX STATE_ID_IDX ON EMPLOYEE (STATE_ID); VARIABLE A NUMBER; EXEC :A := 5; SELECT NAME FROM EMPLOYEE WHERE STATE_ID = :A; EXEC :A := 1; SELECT NAME FROM EMPLOYEE WHERE STATE_ID = :A; INDEX SCAN? FULL TABLE SCAN?
  • 12. SPM Framework ■ SQL Plan Management ▪ New feature in 11g+ for plan stability and control ▪ Only selected plans (Accepted and Enabled) are executed ▪ New plans are captured and stored but not executed (default) ■ SQL Plan Control Flags ▪ Enabled (YES/NO) — Either alive or deleted ▪ Accepted (YES/NO) — If Enabled and Accepted will be executed; if not Accepted can be Evolved ▪ Fixed (YES/NO) “only if accepted and enabled” — Plans have priority over Accepted plans and are not expected to change
  • 13. SPM Framework ■ SQL Plan Baseline ▪ Group/Set of Accepted plans ■ Plan History ▪ Group/Set of Accepted and not-Accepted plans ■ Plan Evolution ▪ Process of making Enabled plans Accepted ■ SQL Management Base ▪ Set of database objects that store Plan History, SQL Plan Baseline and SQL Profiles
  • 14. SPM Framework ■ SQL Plan Management Views ▪ DBA_SQL_PLAN_BASELINES & V$SQL
  • 15. SPM Framework ■ Signature ▪ Unique SQL identifier (hash) from the normalized SQL text (uncased and whitespaces removed) — DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE ■ SQL Plan Status Flags ▪ Reproduced (YES/NO) — CBO can or cannot reproduce the plan ▪ Autopurge (YES/NO) — If YES the plan will be purged if not used, NO never purged ▪ Rejected (YES/NO) — Plan was Unaccepted (Accepted = NO) & has LAST_VERIFIED date or ENABLED=NO
  • 16. SPM Framework ■ SQL Plan Management Initialization Parameters ▪ OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES — FALSE by default. Controls the automatic creation of SQL plan baselines ▪ OPTIMIZER_USE_SQL_PLAN_BASELINES — TRUE by default. Controls the use of SQL plan baselines
  • 17. SPM Framework ■ SQL Plan Management has three main components ▪ Plan Capture — Automatic Plan Capture — Manual Plan Capture ▪ Plan Selection ▪ Plan Evolution — Automatic Plan Evolution — Manual Plan Evolution
  • 18. Agenda ■ SPM Framework - How the SPM framework works - Plan flexibility VS Plan stability ■ Setup SPM - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines ■ Easy SPM Use With OEM 12c - Use OEM 12c Cloud Control to easy the use of SPM ■ SPM Advanced Administration - SPM trace
  • 19. Setup SPM – Plan Capture ■ Automatic Plan Capture ▪ OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES = TRUE ▪ More than one SQL execution
  • 20. Setup SPM – Plan Capture ■ Manual Plan Capture ▪ Most common method to capture plans ▪ PL/SQL package DBMS_SPM or Enterprise Manager 12c ▪ Four different sources — Cursor Cache — SQL Tuning Set — Stored Outlines — Another DB System ▪ Loaded plans are automatically Accepted
  • 21. Setup SPM – Plan Capture ■ Manual Plan Capture
  • 22. Setup SPM – Plan Capture ■ Manual Plan Capture
  • 23. Setup SPM – Plan Capture ■ Manual Plan Capture
  • 24. Setup SPM – Plan Selection ■ OPTIMIZER_USE_SQL_PLAN_BASELINES=TRUE (Default)
  • 25. Setup SPM – Plan Evolution ■ Accept or reject plans ▪ Automatic Plan Evolution — SQL Tuning Advisor task (11g) — SPM Evolve Advisor (SYS_AUTO_SPM_EVOLVE_TASK) (12c) ▪ Manual Plan Evolution — DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE function (11gR2) — SPM Evolve Advisor API (12c) • DBMS_SPM.CREATE_EVOLVE_TASK • DBMS_SPM.EXECUTE_EVOLVE_TASK • DBMS_SPM.REPORT_EVOLVE_TASK • DBMS_SPM.ACCEPT_SQL_PLAN_BASELINE
  • 26. Setup SPM – Plan Evolution ■ Adaptive SQL Plan Management – Automatic Plan Evolution (12c) ▪ Enabled by default ▪ When automatic SQL tuning is in COMPREHENSIVE mode, it runs a verification or evolve process for all SQL statements that have non-accepted plans during the nightly maintenance window. ▪ If the non-accepted plan performs better (1.5x default) than the existing accepted plan (or plans) in the SQL plan baseline, then the plan is automatically accepted and becomes usable by the optimizer. ▪ After the task is complete, a persistent report is generated detailing how the non-accepted plan performs compared to the accepted plan performance.
  • 27. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ 11gR1
  • 28. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ Display execution plans for a baseline ▪ Parameters: — sql_handle => — plan_name => — format => ‘BASIC’, ‘TYPICAL’ & ‘ALL’
  • 29. Setup SPM – Plan Evolution
  • 30. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ 11gR2
  • 31. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ 11gR2 ▪ VERIFY (YES/NO) compare the performance before changing non-accepted plans into accepted plans — When set to 'YES', the non-accepted plan(s) will be accepted if verified to give better performance — When set to 'NO', the non-accepted plan(s) will be changed to accepted plan(s). (11gR1 like) ▪ COMMIT (YES/NO) — When set to 'YES', baseline will be updated to ACCEPTED status and a report will be generated — When set to 'NO', a report will be generated without actually changing the status of the baseline(s) to ACCEPTED.
  • 32.
  • 33. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ 12c ▪ Create evolve task ▪ Execute evolve task
  • 34. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ Generate report ▪ Manual execution of SPM EVOLVE ADVISOR does NOT accept any sql plan baseline!!
  • 35. Setup SPM – Plan Evolution ■ Manual Plan Evolution ▪ Accept the plan baseline recommended by the advisor ▪ If you try to accept the plan baseline which is NOT recommended by SPM EVOLVE ADVISOR, it will fail with ORA-38149. ▪ You can accept the plan baseline which is NOT recommended by SPM EVOLVE ADVISOR, by setting force to TRUE. ▪ How to Manually Evolve and Accept SQL PLAN BASELINES in Oracle 12c (Doc ID 1939828.1)
  • 36. Setup SPM – Plan Evolution ■ Reject Plans ▪ 11gR1
  • 37. Setup SPM – Plan Evolution ■ Reject Plans ▪ 11gR2 & 12c
  • 38. Setup SPM ■ Pack, Load and Unpack baselines ▪ 1. On the original system, create a staging table using the DBMS_SPM.CREATE_STGTAB_BASELINE procedure ▪ 2. Pack the SQL plan baselines you want to export from the SQL management base into the staging table using the DBMS_SPM.PACK_STGTAB_BASELINE function. ▪ 3. Export the staging table into a flat file using the export command or Oracle Data Pump. ▪ 4. Transfer this flat file to the target system. ▪ 5. Import the staging table from the flat file using the import command or Oracle Data Pump. ▪ 6. Unpack the SQL plan baselines from the staging table into the SQL management base on the target system using the DBMS_SPM.UNPACK_STGTAB_BASELINE function.
  • 40. Agenda ■ SPM Framework - How the SPM framework works - Plan flexibility VS Plan stability ■ Setup SPM - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines ■ Easy SPM Use With OEM 12c - Use OEM 12c Cloud Control to easy the use of SPM ■ SPM Advanced Administration - SPM trace
  • 41. Easy SPM Use With OEM 12c
  • 42. Easy SPM Use With OEM 12c
  • 43. Easy SPM Use With OEM 12c
  • 44. Easy SPM Use With OEM 12c
  • 45. Easy SPM Use With OEM 12c
  • 46. Easy SPM Use With OEM 12c
  • 47. Easy SPM Use With OEM 12c
  • 48. Easy SPM Use With OEM 12c
  • 49. Easy SPM Use With OEM 12c
  • 50. Agenda ■ SPM Framework - How the SPM framework works - Plan flexibility VS Plan stability ■ Setup SPM - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines ■ Easy SPM Use With OEM 12c - Use OEM 12c Cloud Control to easy the use of SPM ■ SPM Advanced Administration - SPM trace
  • 51. SPM Administration ■ SPM Trace Doc ID 789520.1 ▪ Issues where the baseline is expected to reproduce a specific plan, but does not work as expected ▪ Issues with the creation or manipulation of baselines ▪ SRDC - How to Collect Standard Information for an Issue Where a SQL Plan Management (SPM) Baseline is Not Used (Doc ID 1644732.1) ENABLE DISABLE
  • 52. SPM Administration ■ SPM Trace Doc ID 789520.1 Open an SR with Oracle Support and provide the trace file
  • 53. SPM Administration ■ SPM Plan Retention ▪ Weekly scheduled task that runs as an automated task in the maintenance window ▪ Purges plans that have not been used for longer than the plan retention period ▪ Default retention is 53 weeks and can be setup from 5 to 523 weeks
  • 54. SPM Administration ■ Manage SBM space limit ▪ Weekly background process measures the total space occupied by the SMB in the SYSAUX tablespace, default 10% ▪ Process writes a warning message to the alert log ▪ Fix by increase SBM space limit, increase SYSAUX size or purge baselines
  • 55. SPM Administration ■ Licensing ▪ SPM is available as part of Oracle Database Enterprise Edition ▪ Includes any of the DBMS_SPM procedures ■ But, below features require the Tuning Pack ▪ Automatic Plan Evolution for SQL Plan Management STA ▪ Load plans from SQL Tuning Sets into SPM, STS can only be created if you have Tuning pack or RAT pack ■ Maria Colgan’s Blog https://blogs.oracle.com/optimizer/entry/does_the_use_of_sql
  • 57. SPM Administration ■ Acceptance threshold in the evolve process ▪ Controlled by hidden parameter ▪ How to Evolve a SQL Plan Baseline and Adjust the Acceptance Threshold (Doc ID 1617790.1)
  • 58. More? ■ Where to Find Information About Performance Related Features (Doc ID 1361401.1) ■ Database SQL Tuning Guide https://docs.oracle.com/database/121/TGSQL/tgsql_spm.htm#TG SQL94621 ■ SQL Plan Management 11g http://www.oracle.com/technetwork/database/bi- datawarehousing/twp-sql-plan-management-11gr2-133099.pdf ■ SQL Plan Management 12c http://www.oracle.com/technetwork/database/bi- datawarehousing/twp-sql-plan-mgmt-12c-1963237.pdf
  • 59. Please complete the session evaluation We appreciate your feedback and insight You may complete the session evaluation either on paper or online via the mobile app