SlideShare a Scribd company logo
Performance Management in Oracle
12c
Prepared by:
Alfredo Krieg
Sr. Oracle Enterprise Cloud Administrator
@alfredokrieg
Who am I?
• Alfredo Krieg (alfredokrieg@gmail.com)
• Senior Oracle Enterprise Cloud Administrator
• Oracle ACE Associate
• NEOOUG Secretary
• OEM Cloud Control 12c and Database Performance Tuning
• Oracle Technologies since 2004 & 11g Certified
• Blog bitkode.blogspot.com
Disclaimer
The opinions expressed in this presentation are
solely mine, and not that of my employer.
Motivation
• Performance problem (regression) on a critical SQL
statement
• Users claim that this SQL has been in 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
• You have the tools but you don’t know
• Sometimes(?) the problem is reported
at 1 am in the morning or Friday 5 pm
Agenda
• Cost Based Optimizer
• SQL Profiles
- SQL Tuning Advisor
- COE script (custom SQL Profiles)
• Oracle SQL Plan Management
- SPM Framework
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
• Oracle Real Time Monitoring
- Usage
- OEM 12c
Cost Based Optimizer
• 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
Cost Based Optimizer
• Cost Based Optimizer CBO
Cost Based Optimizer
• 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
Cost Based Optimizer
• Performance regression
Agenda
• Cost Based Optimizer
• SQL Profiles
- SQL Tuning Advisor
- COE script (custom SQL Profiles)
• Oracle SQL Plan Management
- SPM Framework
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
• Oracle Real Time Monitoring
- Usage
- OEM 12c
SQL Profiles
• Is a database object
• Contains auxiliary statistics specific to a SQL statement (not
to a plan)
• One time statistics
• If the SQL Profile changes, new plans are created
• Over time, profile content can be outdated
• It requires Diagnostics and Tuning license!
• Internally, a profile is implemented using hints
– OPT_ESTIMATE(@SEL$1, TABLE, TEST@SEL$1, SCALE_ROWS=30)
– TABLE_STATS(“SCOTT”, “TEST”, scale, blocks=3, rows=30)
– INDEX_STATS(“SCOTT”, “TEST”, “EMP_IDX”, scale, blocks=3,
rows=30)
SQL Profiles
• Can be created using:
– SQL Tuning Advisor
– Manually, to *lock a plan*
• The Oracle COE script
• Provided by SQLT. Support Note Id 215187.1
• coe_xfr_sql_profile.sql (Kerry’s site)
• SQL Profiles apply to the following statement types:
– SELECT statements
– UPDATE statements
– INSERT statements (only with a SELECT clause)
– DELETE statements
– CREATE TABLE statements (only with the AS SELECT clause)
– MERGE statements (the update or insert operations)
SQL Profiles
• SQL Tuning Advisor
SQL Profiles
• SQL Tuning Advisor
SQL Profiles
• SQL Tuning Advisor
SQL Profiles
• SQL Tuning Advisor
SQL Profiles
• SQL Tuning Advisor
• When the Automatic SQL Tuning task is configured to
implement SQL profiles automatically
• Behavior depends on the setting of the ACCEPT_SQL_PROFILE
SQL Profiles
SQL Profiles
• ACCEPT_SQL_PROFILE
– If set to TRUE, then the advisor implements SQL profiles automatically.
– If set to FALSE, then user intervention is required.
– If set to AUTO (default), then the setting is true when at least one SQL
statement exists with a SQL profile, and false when this condition is not
satisfied.
• Settings of Auto task from OEM 12c
SQL Profiles
• Settings of Auto task from command line
COL PARAMETER_NAME FORMAT a25
COL VALUE FORMAT a10
SELECT PARAMETER_NAME, PARAMETER_VALUE AS "VALUE"
FROM DBA_ADVISOR_PARAMETERS
WHERE ( (TASK_NAME = 'SYS_AUTO_SQL_TUNING_TASK') AND
( (PARAMETER_NAME LIKE '%PROFILE%') OR (PARAMETER_NAME =
'LOCAL_TIME_LIMIT') OR (PARAMETER_NAME = 'EXECUTION_DAYS_TO_EXPIRE')
) );
PARAMETER_NAME VALUE
------------------------- ----------
EXECUTION_DAYS_TO_EXPIRE 30
LOCAL_TIME_LIMIT 1000
ACCEPT_SQL_PROFILES FALSE
MAX_SQL_PROFILES_PER_EXEC 20
MAX_AUTO_SQL_PROFILES 10000
SQL Profiles
• Settings of Auto task from command line
BEGIN DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER
( task_name => 'SYS_AUTO_SQL_TUNING_TASK' ,
parameter => parameter_name ,
value => value ); END; /
BEGIN
DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS
K', 'LOCAL_TIME_LIMIT', 1200);
DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS
K', 'ACCEPT_SQL_PROFILES', 'true');
DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS
K', 'MAX_SQL_PROFILES_PER_EXEC', 50);
DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS
K', 'MAX_AUTO_SQL_PROFILES', 10002); END; /
SQL Profiles
• COE Script
– Identify a plan change in a SQL statement
SELECT SQL_ID, PLAN_HASH_VALUE, CHILD_NUMBER FROM V$SQL WHERE
SQL_ID=‘azcb6w2rc2fwk’;
SQL_ID PLAN_HASH_VALUE CHILD_NUMBER
------------- --------------- ------------
azcb6w2rc2fwk 1378164845 3
azcb6w2rc2fwk 648432385 4
azcb6w2rc2fwk 648432385 2
azcb6w2rc2fwk 1378164845 0
azcb6w2rc2fwk 1378164845 1
azcb6w2rc2fwk 1378164845 5
– Plan 648432385 is the “good” plan but is not longer executed!
SQL Profiles
• Download COE script
– Provided by SQLT. Support Note Id 215187.1
– coe_xfr_sql_profile.sql
$@coe_xfr_sql_profile
Parameter 1:
SQL_ID (required)
Enter value for 1: azcb6w2rc2fwk
PLAN_HASH_VALUE AVG_ET_SECS
--------------- -----------
648432385 .006
1378164845 2.03
Parameter 2:
PLAN_HASH_VALUE (required)
Enter value for 2: 648432385
Values passed:
~~~~~~~~~~~~~
SQL_ID : "azcb6w2rc2fwk"
PLAN_HASH_VALUE: "648432385"
Execute coe_xfr_sql_profile_azcb6w2rc2fwk_648432385.sql
on TARGET system in order to create a custom SQL Profile
with plan 648432385 linked to adjusted sql_text.
SQL Profiles
SQL>DECLARE
2 sql_txt CLOB;
3 h SYS.SQLPROF_ATTR;
4 BEGIN
5 sql_txt := q'[
6 UPDATE TABLE_NAME SET COLUMN_NUMBER = (S... FROM TABLE1..WHERE
7 ... )
8 ]';
9 h := SYS.SQLPROF_ATTR(
10 q'[BEGIN_OUTLINE_DATA]',
11 q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
12 q'[OPTIMIZER_FEATURES_ENABLE('12.1.0.2')]',
13 q'[DB_VERSION('12.1.0.2')]',
14 q'[OPT_PARAM('_b_tree_bitmap_plans' 'false')]',
15 q'[OPT_PARAM('_fast_full_scan_enabled' 'false')]',
16 q'[OPT_PARAM('_optimizer_use_feedback' 'false')]',
17 q'[OPT_PARAM('_px_adaptive_dist_method' 'off')]',
18 q'[OPT_PARAM('_optimizer_dsdir_usage_control' 0)]',
19 q'[OPT_PARAM('_optimizer_adaptive_plans' 'false')]',
20 q'[OPT_PARAM('_optimizer_strans_adaptive_pruning' 'false')]',
21 q'[OPT_PARAM('_optimizer_gather_feedback' 'false')]',
22 q'[OPT_PARAM('_optimizer_nlj_hj_adaptive_join' 'false')]',
23 q'[ALL_ROWS]',
24 q'[FULL(@"SEL$A521A1A9" "TABLE1"@"SEL$2")]',
25 q'[END_OUTLINE_DATA]');
Agenda
• Cost Based Optimizer
• SQL Profiles
- SQL Tuning Advisor
- COE script (custom SQL Profiles)
• Oracle SQL Plan Management
- SPM Framework
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
• Oracle Real Time Monitoring
- Usage
- OEM 12c
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 (SMB)
– 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
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.ALTER_SQL_PLAN_BASELINE (11gR1)
• 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.
Performance Management in Oracle 12c
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
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
• 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)
Agenda
• Cost Based Optimizer
• SQL Profiles
- SQL Tuning Advisor
- COE script (custom SQL Profiles)
• Oracle SQL Plan Management
- SPM Framework
- Enable SQL plan baseline capture
- Evolve plans to stabilize performance
- Pack, Load and Unpack baselines
• Oracle Real Time Monitoring
- Usage
- OEM 12c
Oracle Real-Time SQL Monitoring
• Introduced in 11g
• By default, started automatically when a SQL runs in
parallel or has consumed at least 5 seconds of CPU and/or
I/O combined in a single execution
• Can be forced using the hint /*+ MONITOR */
• Requires STATISTICS_LEVEL set to ‘TYPICAL’ or ‘ALL’
• Diagnostic and Tuning license
• 2 System Views
– V$SQL_MONITOR
– V$SQL_PLAN_MONITOR
• 2 Packages
– DBMS_SQLTUNE.report_sql_monitor_list
– DBMS_SQLTUNE.report_sql_detail
Oracle Real-Time SQL Monitoring
• SQL Real-Time Monitor in OEM 12c
Oracle Real-Time SQL Monitoring
• SQL Real-Time Monitor in OEM 12c
Oracle Real-Time SQL Monitoring
• SQL Real-Time Monitor in OEM 12c
Oracle Real-Time SQL Monitoring
• SQL Real-Time Monitor in OEM 12c
Thank You!

More Related Content

What's hot (20)

PPTX
PostGreSQL Performance Tuning
Maven Logix
 
PDF
Ibm db2 10.5 for linux, unix, and windows data movement utilities guide and...
bupbechanhgmail
 
DOCX
VERİTABANI SIZMA TESTLERİ
BGA Cyber Security
 
PDF
Metasploit El Kitabı
BGA Cyber Security
 
DOCX
LINUX, WINDOWS VE AĞ SİSTEMLERİ SIZMA TESTLERİ
BGA Cyber Security
 
PDF
SMBetray—Backdooring and breaking signatures
Priyanka Aash
 
DOC
Oracle ebs otl setup document
Feras Ahmad
 
PDF
Oracle Database Performance Tuning Concept
Chien Chung Shen
 
PDF
Web Uygulama Güvenliği 101
Mehmet Ince
 
PDF
Performance Stability, Tips and Tricks and Underscores
Jitendra Singh
 
PPTX
AWR and ASH Deep Dive
Kellyn Pot'Vin-Gorman
 
PDF
SQL Monitoring in Oracle Database 12c
Tanel Poder
 
PDF
Awr + 12c performance tuning
AiougVizagChapter
 
PDF
Uygulamalı Ağ Güvenliği Eğitimi Lab Çalışmaları
BGA Cyber Security
 
PDF
ProxySQL High Availability (Clustering)
Mydbops
 
PDF
Oracle Veritabanı Güvenlik Testi Çalışmaları
BGA Cyber Security
 
PDF
Creating new service name for oracle database
Ravi Kumar Lanke
 
PDF
Performance tuning in sql server
Antonios Chatzipavlis
 
PPT
9. partitioning
Trần Thanh
 
ODP
SQL Tunning
Dhananjay Goel
 
PostGreSQL Performance Tuning
Maven Logix
 
Ibm db2 10.5 for linux, unix, and windows data movement utilities guide and...
bupbechanhgmail
 
VERİTABANI SIZMA TESTLERİ
BGA Cyber Security
 
Metasploit El Kitabı
BGA Cyber Security
 
LINUX, WINDOWS VE AĞ SİSTEMLERİ SIZMA TESTLERİ
BGA Cyber Security
 
SMBetray—Backdooring and breaking signatures
Priyanka Aash
 
Oracle ebs otl setup document
Feras Ahmad
 
Oracle Database Performance Tuning Concept
Chien Chung Shen
 
Web Uygulama Güvenliği 101
Mehmet Ince
 
Performance Stability, Tips and Tricks and Underscores
Jitendra Singh
 
AWR and ASH Deep Dive
Kellyn Pot'Vin-Gorman
 
SQL Monitoring in Oracle Database 12c
Tanel Poder
 
Awr + 12c performance tuning
AiougVizagChapter
 
Uygulamalı Ağ Güvenliği Eğitimi Lab Çalışmaları
BGA Cyber Security
 
ProxySQL High Availability (Clustering)
Mydbops
 
Oracle Veritabanı Güvenlik Testi Çalışmaları
BGA Cyber Security
 
Creating new service name for oracle database
Ravi Kumar Lanke
 
Performance tuning in sql server
Antonios Chatzipavlis
 
9. partitioning
Trần Thanh
 
SQL Tunning
Dhananjay Goel
 

Viewers also liked (13)

PPTX
Componenets of osb12c
TUSHAR VARSHNEY
 
PDF
oracle-osb
AbrarMoiz
 
PDF
oracle service bus
TUSHAR VARSHNEY
 
PPT
Oracle PL/SQL - Creative Conditional Compilation
Scott Wesley
 
PPTX
Oracle Service Bus 12c (12.2.1) What You Always Wanted to Know
Frank Munz
 
PDF
Oracle Service Bus (OSB) for the Busy IT Professonial
Frank Munz
 
PDF
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Nelson Calero
 
PPT
Less05 asm instance
Amit Bhalla
 
PDF
Osb student guide
Vibhor Rastogi
 
PDF
What You Should Know About WebLogic Server 12c (12.2.1.2) #oow2015 #otntour2...
Frank Munz
 
PPTX
Where and when to use the Oracle Service Bus (OSB)
Guido Schmutz
 
PPTX
SQLcl overview - A new Command Line Interface for Oracle Database
Jeff Smith
 
PDF
Oracle OSB Tutorial 1
Rakesh Gujjarlapudi
 
Componenets of osb12c
TUSHAR VARSHNEY
 
oracle-osb
AbrarMoiz
 
oracle service bus
TUSHAR VARSHNEY
 
Oracle PL/SQL - Creative Conditional Compilation
Scott Wesley
 
Oracle Service Bus 12c (12.2.1) What You Always Wanted to Know
Frank Munz
 
Oracle Service Bus (OSB) for the Busy IT Professonial
Frank Munz
 
Evolution of Performance Management: Oracle 12c adaptive optimizations - ukou...
Nelson Calero
 
Less05 asm instance
Amit Bhalla
 
Osb student guide
Vibhor Rastogi
 
What You Should Know About WebLogic Server 12c (12.2.1.2) #oow2015 #otntour2...
Frank Munz
 
Where and when to use the Oracle Service Bus (OSB)
Guido Schmutz
 
SQLcl overview - A new Command Line Interface for Oracle Database
Jeff Smith
 
Oracle OSB Tutorial 1
Rakesh Gujjarlapudi
 
Ad

Similar to Performance Management in Oracle 12c (20)

PDF
31063115_1679409488310Developer_Tuning_Tips_-_UTOUG_Mar_2023.pdf
TricantinoLopezPerez
 
PPTX
Oracle SPM 12c. IOUG #C15LV
Alfredo Krieg
 
PDF
Oracle SQL tuning with SQL Plan Management
Bjoern Rost
 
PDF
In Search of Plan Stability - Part 1
Enkitec
 
PDF
Setting up the Oracle Optimizer for Proof of Concept Testing
Nigel Bayliss
 
PDF
Advanced tips for making Oracle databases faster
SolarWinds
 
PPTX
Oracle Query Optimizer - An Introduction
adryanbub
 
PPTX
SQL Tuning 101
Carlos Sierra
 
PDF
sqltuning101-170419021007-2.pdf
TricantinoLopezPerez
 
PDF
Controlling execution plans 2014
Enkitec
 
PPTX
Oracle 12c SPM
Anton Bushmelev
 
PPTX
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Michael Rosenblum
 
PDF
Optimizer Statistics
Connor McDonald
 
PPT
Sql tuning
Wilson Harawoola
 
PDF
SQL_Tuning_Oracle_10g.pdf
NareshKumar729083
 
PDF
DB Optimizer Datasheet - Automated SQL Profiling & Tuning for Optimized Perfo...
Embarcadero Technologies
 
PDF
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
cookie1969
 
PDF
O_Need-for-Speed_Top-Five-Oracle-Performance-Tuning-Tips_NYOUG.pdf
cookie1969
 
PDF
In Search of Plan Stability Part 2 with Karen Morton
Embarcadero Technologies
 
PDF
Oracle Performance Tuning Training.pdf
SpiritsoftsTraining
 
31063115_1679409488310Developer_Tuning_Tips_-_UTOUG_Mar_2023.pdf
TricantinoLopezPerez
 
Oracle SPM 12c. IOUG #C15LV
Alfredo Krieg
 
Oracle SQL tuning with SQL Plan Management
Bjoern Rost
 
In Search of Plan Stability - Part 1
Enkitec
 
Setting up the Oracle Optimizer for Proof of Concept Testing
Nigel Bayliss
 
Advanced tips for making Oracle databases faster
SolarWinds
 
Oracle Query Optimizer - An Introduction
adryanbub
 
SQL Tuning 101
Carlos Sierra
 
sqltuning101-170419021007-2.pdf
TricantinoLopezPerez
 
Controlling execution plans 2014
Enkitec
 
Oracle 12c SPM
Anton Bushmelev
 
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Michael Rosenblum
 
Optimizer Statistics
Connor McDonald
 
Sql tuning
Wilson Harawoola
 
SQL_Tuning_Oracle_10g.pdf
NareshKumar729083
 
DB Optimizer Datasheet - Automated SQL Profiling & Tuning for Optimized Perfo...
Embarcadero Technologies
 
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
cookie1969
 
O_Need-for-Speed_Top-Five-Oracle-Performance-Tuning-Tips_NYOUG.pdf
cookie1969
 
In Search of Plan Stability Part 2 with Karen Morton
Embarcadero Technologies
 
Oracle Performance Tuning Training.pdf
SpiritsoftsTraining
 
Ad

More from Alfredo Krieg (10)

PDF
Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
Alfredo Krieg
 
PDF
Exadata SMART Monitoring - OEM 13c
Alfredo Krieg
 
PDF
Collaborate 2019 - How to Understand an AWR Report
Alfredo Krieg
 
PDF
Simplifying EBS 12.2 ADOP - Collaborate 2019
Alfredo Krieg
 
PPTX
Oracle database 12.2 new features
Alfredo Krieg
 
PPTX
Where did my day go?: Oracle Enterprise Manager 12c/13c Administration
Alfredo Krieg
 
PDF
Monitor Engineered Systems from a Single Pane of Glass: Oracle Enterprise Man...
Alfredo Krieg
 
PPTX
Where did my day go?: OEM 12c Administration #em12c #C15LV @IOUG
Alfredo Krieg
 
PDF
Oracle database performance are database users telling me the truth
Alfredo Krieg
 
PDF
553: Oracle Database Performance: Are Database Users Telling Me The Truth?
Alfredo Krieg
 
Clone Oracle Databases In Minutes Without Risk Using Enterprise Manager 13c
Alfredo Krieg
 
Exadata SMART Monitoring - OEM 13c
Alfredo Krieg
 
Collaborate 2019 - How to Understand an AWR Report
Alfredo Krieg
 
Simplifying EBS 12.2 ADOP - Collaborate 2019
Alfredo Krieg
 
Oracle database 12.2 new features
Alfredo Krieg
 
Where did my day go?: Oracle Enterprise Manager 12c/13c Administration
Alfredo Krieg
 
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
Alfredo Krieg
 
Oracle database performance are database users telling me the truth
Alfredo Krieg
 
553: Oracle Database Performance: Are Database Users Telling Me The Truth?
Alfredo Krieg
 

Recently uploaded (20)

PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Designing Production-Ready AI Agents
Kunal Rai
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 

Performance Management in Oracle 12c

  • 1. Performance Management in Oracle 12c Prepared by: Alfredo Krieg Sr. Oracle Enterprise Cloud Administrator @alfredokrieg
  • 2. Who am I? • Alfredo Krieg ([email protected]) • Senior Oracle Enterprise Cloud Administrator • Oracle ACE Associate • NEOOUG Secretary • OEM Cloud Control 12c and Database Performance Tuning • Oracle Technologies since 2004 & 11g Certified • Blog bitkode.blogspot.com
  • 3. Disclaimer The opinions expressed in this presentation are solely mine, and not that of my employer.
  • 4. Motivation • Performance problem (regression) on a critical SQL statement • Users claim that this SQL has been in 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 • You have the tools but you don’t know • Sometimes(?) the problem is reported at 1 am in the morning or Friday 5 pm
  • 5. Agenda • Cost Based Optimizer • SQL Profiles - SQL Tuning Advisor - COE script (custom SQL Profiles) • Oracle SQL Plan Management - SPM Framework - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines • Oracle Real Time Monitoring - Usage - OEM 12c
  • 6. Cost Based Optimizer • 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
  • 7. Cost Based Optimizer • Cost Based Optimizer CBO
  • 8. Cost Based Optimizer • 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
  • 9. Cost Based Optimizer • Performance regression
  • 10. Agenda • Cost Based Optimizer • SQL Profiles - SQL Tuning Advisor - COE script (custom SQL Profiles) • Oracle SQL Plan Management - SPM Framework - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines • Oracle Real Time Monitoring - Usage - OEM 12c
  • 11. SQL Profiles • Is a database object • Contains auxiliary statistics specific to a SQL statement (not to a plan) • One time statistics • If the SQL Profile changes, new plans are created • Over time, profile content can be outdated • It requires Diagnostics and Tuning license! • Internally, a profile is implemented using hints – OPT_ESTIMATE(@SEL$1, TABLE, TEST@SEL$1, SCALE_ROWS=30) – TABLE_STATS(“SCOTT”, “TEST”, scale, blocks=3, rows=30) – INDEX_STATS(“SCOTT”, “TEST”, “EMP_IDX”, scale, blocks=3, rows=30)
  • 12. SQL Profiles • Can be created using: – SQL Tuning Advisor – Manually, to *lock a plan* • The Oracle COE script • Provided by SQLT. Support Note Id 215187.1 • coe_xfr_sql_profile.sql (Kerry’s site) • SQL Profiles apply to the following statement types: – SELECT statements – UPDATE statements – INSERT statements (only with a SELECT clause) – DELETE statements – CREATE TABLE statements (only with the AS SELECT clause) – MERGE statements (the update or insert operations)
  • 13. SQL Profiles • SQL Tuning Advisor
  • 14. SQL Profiles • SQL Tuning Advisor
  • 15. SQL Profiles • SQL Tuning Advisor
  • 16. SQL Profiles • SQL Tuning Advisor
  • 17. SQL Profiles • SQL Tuning Advisor • When the Automatic SQL Tuning task is configured to implement SQL profiles automatically • Behavior depends on the setting of the ACCEPT_SQL_PROFILE
  • 19. SQL Profiles • ACCEPT_SQL_PROFILE – If set to TRUE, then the advisor implements SQL profiles automatically. – If set to FALSE, then user intervention is required. – If set to AUTO (default), then the setting is true when at least one SQL statement exists with a SQL profile, and false when this condition is not satisfied. • Settings of Auto task from OEM 12c
  • 20. SQL Profiles • Settings of Auto task from command line COL PARAMETER_NAME FORMAT a25 COL VALUE FORMAT a10 SELECT PARAMETER_NAME, PARAMETER_VALUE AS "VALUE" FROM DBA_ADVISOR_PARAMETERS WHERE ( (TASK_NAME = 'SYS_AUTO_SQL_TUNING_TASK') AND ( (PARAMETER_NAME LIKE '%PROFILE%') OR (PARAMETER_NAME = 'LOCAL_TIME_LIMIT') OR (PARAMETER_NAME = 'EXECUTION_DAYS_TO_EXPIRE') ) ); PARAMETER_NAME VALUE ------------------------- ---------- EXECUTION_DAYS_TO_EXPIRE 30 LOCAL_TIME_LIMIT 1000 ACCEPT_SQL_PROFILES FALSE MAX_SQL_PROFILES_PER_EXEC 20 MAX_AUTO_SQL_PROFILES 10000
  • 21. SQL Profiles • Settings of Auto task from command line BEGIN DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER ( task_name => 'SYS_AUTO_SQL_TUNING_TASK' , parameter => parameter_name , value => value ); END; / BEGIN DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS K', 'LOCAL_TIME_LIMIT', 1200); DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS K', 'ACCEPT_SQL_PROFILES', 'true'); DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS K', 'MAX_SQL_PROFILES_PER_EXEC', 50); DBMS_SQLTUNE.SET_TUNING_TASK_PARAMETER('SYS_AUTO_SQL_TUNING_TAS K', 'MAX_AUTO_SQL_PROFILES', 10002); END; /
  • 22. SQL Profiles • COE Script – Identify a plan change in a SQL statement SELECT SQL_ID, PLAN_HASH_VALUE, CHILD_NUMBER FROM V$SQL WHERE SQL_ID=‘azcb6w2rc2fwk’; SQL_ID PLAN_HASH_VALUE CHILD_NUMBER ------------- --------------- ------------ azcb6w2rc2fwk 1378164845 3 azcb6w2rc2fwk 648432385 4 azcb6w2rc2fwk 648432385 2 azcb6w2rc2fwk 1378164845 0 azcb6w2rc2fwk 1378164845 1 azcb6w2rc2fwk 1378164845 5 – Plan 648432385 is the “good” plan but is not longer executed!
  • 23. SQL Profiles • Download COE script – Provided by SQLT. Support Note Id 215187.1 – coe_xfr_sql_profile.sql $@coe_xfr_sql_profile Parameter 1: SQL_ID (required) Enter value for 1: azcb6w2rc2fwk PLAN_HASH_VALUE AVG_ET_SECS --------------- ----------- 648432385 .006 1378164845 2.03 Parameter 2: PLAN_HASH_VALUE (required) Enter value for 2: 648432385 Values passed: ~~~~~~~~~~~~~ SQL_ID : "azcb6w2rc2fwk" PLAN_HASH_VALUE: "648432385" Execute coe_xfr_sql_profile_azcb6w2rc2fwk_648432385.sql on TARGET system in order to create a custom SQL Profile with plan 648432385 linked to adjusted sql_text.
  • 24. SQL Profiles SQL>DECLARE 2 sql_txt CLOB; 3 h SYS.SQLPROF_ATTR; 4 BEGIN 5 sql_txt := q'[ 6 UPDATE TABLE_NAME SET COLUMN_NUMBER = (S... FROM TABLE1..WHERE 7 ... ) 8 ]'; 9 h := SYS.SQLPROF_ATTR( 10 q'[BEGIN_OUTLINE_DATA]', 11 q'[IGNORE_OPTIM_EMBEDDED_HINTS]', 12 q'[OPTIMIZER_FEATURES_ENABLE('12.1.0.2')]', 13 q'[DB_VERSION('12.1.0.2')]', 14 q'[OPT_PARAM('_b_tree_bitmap_plans' 'false')]', 15 q'[OPT_PARAM('_fast_full_scan_enabled' 'false')]', 16 q'[OPT_PARAM('_optimizer_use_feedback' 'false')]', 17 q'[OPT_PARAM('_px_adaptive_dist_method' 'off')]', 18 q'[OPT_PARAM('_optimizer_dsdir_usage_control' 0)]', 19 q'[OPT_PARAM('_optimizer_adaptive_plans' 'false')]', 20 q'[OPT_PARAM('_optimizer_strans_adaptive_pruning' 'false')]', 21 q'[OPT_PARAM('_optimizer_gather_feedback' 'false')]', 22 q'[OPT_PARAM('_optimizer_nlj_hj_adaptive_join' 'false')]', 23 q'[ALL_ROWS]', 24 q'[FULL(@"SEL$A521A1A9" "TABLE1"@"SEL$2")]', 25 q'[END_OUTLINE_DATA]');
  • 25. Agenda • Cost Based Optimizer • SQL Profiles - SQL Tuning Advisor - COE script (custom SQL Profiles) • Oracle SQL Plan Management - SPM Framework - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines • Oracle Real Time Monitoring - Usage - OEM 12c
  • 26. 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
  • 27. 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 (SMB) – Set of database objects that store Plan History, SQL Plan Baseline and SQL Profiles
  • 28. SPM Framework • SQL Plan Management Views – DBA_SQL_PLAN_BASELINES & V$SQL
  • 29. 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
  • 30. 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
  • 31. 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
  • 32. Setup SPM – Plan Capture • Automatic Plan Capture – OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES = TRUE – More than one SQL execution
  • 33. 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
  • 34. Setup SPM – Plan Capture • Manual Plan Capture
  • 35. Setup SPM – Plan Capture • Manual Plan Capture
  • 36. Setup SPM – Plan Capture • Manual Plan Capture
  • 37. Setup SPM – Plan Selection • OPTIMIZER_USE_SQL_PLAN_BASELINES=TRUE (Default)
  • 38. 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.ALTER_SQL_PLAN_BASELINE (11gR1) • 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
  • 39. 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.
  • 40. Setup SPM – Plan Evolution • Manual Plan Evolution – 11gR1
  • 41. Setup SPM – Plan Evolution • Manual Plan Evolution – Display execution plans for a baseline – Parameters: • sql_handle => • plan_name => • format => ‘BASIC’, ‘TYPICAL’ & ‘ALL’
  • 42. Setup SPM – Plan Evolution
  • 43. Setup SPM – Plan Evolution • Manual Plan Evolution – 11gR2
  • 44. 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.
  • 46. Setup SPM – Plan Evolution • Manual Plan Evolution – 12c – Create evolve task – Execute evolve task
  • 47. Setup SPM – Plan Evolution • Manual Plan Evolution – Generate report – Manual execution of SPM EVOLVE ADVISOR does NOT accept any SQL plan baseline!!
  • 48. 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)
  • 49. Setup SPM – Plan Evolution • Reject Plans – 11gR1
  • 50. Setup SPM – Plan Evolution • Reject Plans – 11gR2 & 12c
  • 51. 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.
  • 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
  • 56. 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)
  • 57. Agenda • Cost Based Optimizer • SQL Profiles - SQL Tuning Advisor - COE script (custom SQL Profiles) • Oracle SQL Plan Management - SPM Framework - Enable SQL plan baseline capture - Evolve plans to stabilize performance - Pack, Load and Unpack baselines • Oracle Real Time Monitoring - Usage - OEM 12c
  • 58. Oracle Real-Time SQL Monitoring • Introduced in 11g • By default, started automatically when a SQL runs in parallel or has consumed at least 5 seconds of CPU and/or I/O combined in a single execution • Can be forced using the hint /*+ MONITOR */ • Requires STATISTICS_LEVEL set to ‘TYPICAL’ or ‘ALL’ • Diagnostic and Tuning license • 2 System Views – V$SQL_MONITOR – V$SQL_PLAN_MONITOR • 2 Packages – DBMS_SQLTUNE.report_sql_monitor_list – DBMS_SQLTUNE.report_sql_detail
  • 59. Oracle Real-Time SQL Monitoring • SQL Real-Time Monitor in OEM 12c
  • 60. Oracle Real-Time SQL Monitoring • SQL Real-Time Monitor in OEM 12c
  • 61. Oracle Real-Time SQL Monitoring • SQL Real-Time Monitor in OEM 12c
  • 62. Oracle Real-Time SQL Monitoring • SQL Real-Time Monitor in OEM 12c