Академический Документы
Профессиональный Документы
Культура Документы
Oracle Database
Performance
Management Best
Practices
Database time is total time spent by user processes either actively working or actively
waiting in a database call.
Find a Implement a
problematic possible Fix
Will optimizer_index_cost_adj metric Default value is 100,
improving my sequential reads… …so let’s set it to 50…
The “trial and error” method can consume more than 50% of the DBA time
SQL
Performance Validates
Validate
Analyzer tuning activities
(SPA) (Real Application Testing)
SQL Performance
Analyzer (SPA)
Rich feature-set provides comprehensive support for diagnosing problems: System Session, Targeted or Transient, Hung or
slow moving databases, etc. Built into the Oracle kernel and highly optimized (already part of the SGA)
DB Time
Top Level
Session PL/SQL
Plan Hash
PL/SQL
Wait Event Services Module
Attributes
Session
Resources
Identifiers Program Trans. ID
Session Type
24
2 Identify the module that suffered from this type of
contention from the top service/module
section
• Graphical ASH report for advanced analysis • Different visualizations: Stacked chart or Tree Map
• Provides visual filtering for recursive drill-downs • Collaborate with others using Active Reports
• Select any time period for analysis
• Analyze performance across many dimensions
Undersized SGA
AWR Snapshot Compare Analysis Report
Period 2 Period ADDM
ADDM
Database Analysis
• Makes a lightweight connection without acquiring additional locks and resources, bypassing the
SQL layer through the agent
• Also attempts to initiate standard JDBC connection
• Data returned by either connection is analyzed by ADDM
RESOURCES
Hardware resource crunch Not parallelized (no scaling to large data)
Resource &
Contention Issues Contention (row lock contention, block contention) Improperly parallelized (partially parallelized, skews)
Data fragmentation Rapidly changing data
APPLICATIONS
Missing access structures
Poorly written SQL statements
Application Issues Bind-sensitive SQL with bind peeking (Cursor Sharing)
Literal usage
Comprehensive
Automatic Tuning Optimizer
SQL Tuning
Recommendations
submit create
Optimizer
(Tuning Mode)
After …
submit output
Optimizer
(Normal Mode)
Well-Tuned
Database Plan
Users
one hour
DBA
Packaged Custom
• Complete automation of SQL tuning
Apps Apps
• Automatically captures high-load SQL
Auto Capture High-Load SQL • Automatically tunes SQL without
Nightly changing application by creating SQL
Automatic SQL Tuning Profiles
SQL Profiles SQL Analysis
• Automatically implements (optional)
greatly improved SQL plans
Automatic • Automatically reports analysis
implement Report
Manually
• Automatically runs during maintenance
implement window
Well-tuned SQL
Workload
Generate
Recommendations
Choose Candidate
SQL
SQL Tuning
one week Candidates
It’s Automatic!
Partitions (11g +)
MV and MV Logs
DBA
Partition Advisor:
• Range Partition
• Interval Partition • Provides List Partition recommendations for 12c Database
• Hash Partition • Analyzes already partitioned tables for further optimization
• List Partition
DB 11.2
1
1 2 3 4 5 6 7 8 9 10
DB 12.1 SQL Workload Size (in thousands)
My simple query is taking longer than before. What could have gone
wrong?
• Parallel Downgrades
– Uncontrolled parallel execution
– Parallel Server availability
– Object level settings
– Session level settings
Challenge: Solution:
3
2 5
1
4
Test Production
Test System: Safe but… Database Database Production System: Easier but…
Production
Database
Change- • Context-aware change testing workflows, such as,
• Optimizer gather statistics
Pre-selected
STS and
default SPA
Minimizes use of
Identifies subset Test-executes only production No full DML
Multiple executions (execute Select
SQL workload with SQLs with plan resources disabled
plan changes first changes dramatically – up part of workload)
to 10x reduction
SQL Performance
Analyzer (SPA)
• Database Home Page gives a quick high level overview of current status
• Database found to be running high load (Active Sessions)
• ADDM has already detected some performance issues (5 findings)
• For further investigation, look at the DB Perf. Page and “Click on the Big Stuff”
• DB Perf. Page shows significant resource being utilized on CPU and User I/O
• Clicking on the snapshot icon will take us to the ADDM Home Page for that time
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 83
Step 1 – The Find
• ADDM Home Page
Tuning
STEP 1 - Find Issues
Diagnostics STEP 2 - Fix Issues
SQL Performance
Analyzer (SPA)
Become
• MORE proactive and strategic
• MORE important and valuable!
1
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
AWR
• Use AWR Warehouse for longer retention period:
– Allows long term analysis
– Zero overhead and impact on production
• Global AWR reports:
– Use Global AWR reports for RAC
– Configured using $OH/rdbms/admin/awrgrpt.sql
• Adaptive thresholds:
– The significance level thresholds give users a way to specify alerting in terms of "how
unusual" rather than "how much“
• Performance tuning metrics:
– Use DB Time, CPU Time IO time , not just Elapsed time for performance tuning
– DB Time encompasses multiple metrics and provides better insight into the performance of
the system
We can change the Top N SQL or sessions to display in Top Activity. Here is how to do it
• Performance Hub
– Provides a new consolidated view of all performance data for a given time range
– The Performance Hub can also be saved as a Composite Active Report
• Real Time Performance Hub, Historical Performance Hub, Real-time Performance Hub (RAC)
DB 12c update
• In addition to the composite active reports -- there is now also an active report for SQL Tuning and Automatic Real-
time ADDM
• The SPA and SQL Monitor Details active reports, which were introduced in 11g, have also been enhanced
• For example, the following SQL*Plus script shows you how to generate a Real-time PerfHub Active Report:
SQL>set pages 0
SQL>linesize 32767
SQL>trimspool on
SQL>trim on
SQL>long 1000000
SQL>longchunksize 10000000
SQL>spool perfhub_active.html
SQL>select dbms_perf.report_perfhub(is_realtime=>1,type=>'active') from dual;
The resulting file perfhub_active.html should be edited to remove the header (first line in the file) and the last line (spool off).
60% 60%
increases storage overhead and cost
60%
Comprehensive
Integrated Install Small Footprint
Administration
• Pre-configured & installed • Disk: 20 MB • Basic admin support for:
with the database • Runtime: zero when idle • Storage management
• Runs inside database • Minimal CPU, memory • Security management
• No extra MW components overhead • Configuration management
• Leverages XDB server inside • 100% of UI rendering • Advanced performance
db for web services performed in browser diagnostics and tuning
• Supports SI, RAC, SE, EE • DB Server only runs SQL
• Actionable recommendations
– Workload based cost/benefit analysis
– In-memory area population plan
• Report
– Vary IM Column Store size to receive specific loading plan
– Generate DDL script with all the tables/partitions/sub-partitions recommended
– Top SQL benefits from given configuration
• RAC advice
– In-Memory Column Store configuration can vary by instance
• Join : Changes join method from Nested Loops to Hash Join, and vice versa, based on cardinality.
• Parallel Distribution : Changes data distribution method among parallel processes from Hybrid Hash to
Broadcast, based on cardinality.
• Even when enabled, factors like predicate complexity, existing base statistics and
total execution time expected determines whether to gather dynamics statistics or not.
In contrast to adaptive plans, automatic reoptimization changes a plan on subsequent executions after
the initial execution.
• Statistics feedback : When SQL statement is executed (with statistics feedback monitoring enabled) for the first
time, optimizer compares its original cardinality estimates to the actual cardinalities observed during execution
and, if estimates differ significantly from actual cardinalities, it stores the correct estimates for subsequent use.
After the first execution, the optimizer disables monitoring for statistics feedback.
• Performance feedback : The parallel degree chosen by the optimizer is compared to the parallel degree
computed base on the actual performance statistics (e.g. CPU-time) gathered during the
initial execution of the statement. If the two values vary significantly then the statement is marked for
reoptimization and the initial execution performance statistics are stored as feedback to help compute a
more appropriate degree of parallelism for subsequent executions.
• SQL plan directives, created automatically as a result of Automatic Reoptimzation, can direct the optimizer to
use dynamic statistics to obtain more accurate cardinality estimate.
• Created whenever there is a mismatch between optimizer's cardinality estimates and the actual number of
rows returned after execution.