Download Performance Tuning Fundamentals for Oracle Database 10g

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Neuroinformatics wikipedia , lookup

Data analysis wikipedia , lookup

Strähle construction wikipedia , lookup

Transcript
<Insert Picture Here>
Performance Tuning Fundamentals for
Oracle Database 10g and 11g
Mughees A. Minhas
Senior Director of Product Management
Database and Systems Management
Outline
• Historical Perspective
• Key Concepts
• Key Infrastructure Components
• Tuning Techniques
• Q&A
<Insert Picture Here>
Historical Perspective
Oracle Tuning Methods
• Prehistoric (v5)
• Debug code
• Dark Ages (v6)
• Counters/Ratios
• BSTAT/ESTAT
• SQL*Trace
• Renaissance (v7)
• Introduction of Wait Event instrumentation
• Move from counters to timers
• STATSPACK
• Modernity (v10)
• DB Time Tuning – Comprehensive tuning using fundamental notion of time in
database
• Multiple scoping levels
• Always on, non-intrusive
• Built into infrastructure: instrumentation, ASH, AWR, ADDM, EM
<Insert Picture Here>
Key Concepts
Database Time (DB Time)
• Total time in database calls by foreground sessions
• Includes CPU time, IO time and non-idle wait time
• DB Time <> response time
• New metric for Oracle performance analysis
Database time is total time spent by user
processes either actively working or actively
waiting in a database call.
Fundamental Concepts
Active Session =
Session currently spending time in a database call
Database Time (DB Time) =
Total time session spent in all database calls
Average Activity of the Session (% Activity) =
The ratio of time active to total wall-clock time
Browse
Read Reviews
Books
For One Book
= time spent in database
Add to Cart
Checkout
TIME
Multiple Sessions
DB Time = Sum of DB Time Over All Sessions
Avg. Active Sessions = Sum of Avg. Activity Over All Sessions
=
Total Database Time
Wall-Clock (Elapsed) Time
At time t we have 2 active sessions
User 1
User 2
User 3
User n
= time spent in database
t
TIME
EM Performance page
• Active Sessions by wait class over time
• Colored area = amount of DB time
• “Click on the big stuff…”
<Insert Picture Here>
Key Infrastructure
Components
Automatic Workload Repository (AWR)
• Built-in workload and performance statistics repository in the
database
• Automatically Captures Workload Data
•
Every 60 minutes, or manually, saves data for 8 days by default
• Resides in SYSAUX tablespace
• Space requirements automatically managed
•
Old data is automatically purged nightly based on retention
interval
• Stores different classes of data:
•
•
•
•
BASE STATISTICS e.g., physical reads
SQL STATISTICS e.g., disk reads (per sql stmt)
METRICS e.g., physical reads / sec
ACTIVE SESSION HISTORY (ASH)
Active Session History (ASH)
• Samples active sessions every one second into memory
(v$active_session_history)
• Direct access to kernel structures
• One of ten samples flushed to AWR at every snapshot
• Data captured includes:
•
•
•
•
•
•
SID
SQL ID
Program, Module, Action
Wait event#
Object, File, Block
actual wait time (if captured while waiting)
Enables targeted performance analysis
of transient problems
Active Session History (ASH)
Query for
Khalid
Husaini
Novels
Browse and
Read
Reviews
Add
item to
cart
Checkout
using
‘one-click’
DB Time
Time
SID
Module
SQL ID
State
Event
db file sequential
read
7:38:26
213
Book by author
qa324jffritcf
WAITING
7:42:35
213
Get review id
aferv5desfzs5
CPU
7:50:59
213
Add to cart
hk32pekfcbdfr
WAITING
buffer busy wait
7:52:33
213
One click
abngldf95f4de
WAITING
log file sync
<Insert Picture Here>
Tuning Techniques
Basic Performance Tuning Process
• Performance and workload data capture
•
System statistics, wait information, SQL
Statistics, etc.
AWR
• Analysis
•
•
•
•
What types of operations are consuming
most time?
Which resources is the bottleneck?
What is the root cause?
How can problem be remediated?
ADDM
• Problem Resolution
•
•
If multiple problems identified, which is
most critical?
Which solution will give me most benefit?
ADDM
Automatic System-Wide Analysis with
ADDM
Snapshots in
Automatic Workload
Repository
•
•
Automatic Diagnostic
Engine
Self-Diagnostic
Engine inside
DB
•
•
•
•
High-load
SQL
IO / CPU
issues
RAC issues
•
•
SQL
Advisor
System
Resource
Advice
Network +
DB config
Advice
Automatic Database Diagnostic
Monitor (ADDM)
Automatically provides databasewide performance diagnostic
Self-diagnostic engine in the
database
Integrate all components together
RAC aware
Provides impact and benefit
analysis, non problem areas
Runs proactively out of the box,
reactively when required
Available for real-time and historical
analysis
Manual Performance Analysis
• The CBS Method
(“Click on the Big
Stuff method”)
• Shows ASH
samples for the
selected wait class
• Answers the “who”
and “what” of the
problem
• Who is slowing up
the system?
• What is that person
doing?
Targeted Performance Analysis with
ASH
• ASH enables targeted performance analysis for transient problems
• ASH Report can be filtered by time, SID, SQL ID, Wait Class, Service,
Module, Action, Client ID
• Helps answers questions like “has this SQL gotten slower over time?”
Performance
Range
*
Time
Comparative Performance Analysis with
AWR Baselines and Reports
Performance
Actual
Baseline
time
• Automatic creation and
management of reference
baselines
• Enables performance comparison
of two periods with AWR Reports
• Makes analysis of workload
variations and performance
diagnosis easier
• Moving window baseline created
out-of-the-box
• Enables proactive monitoring with
adaptive thresholds
• Baseline is key for performance
tuning to
• Set alert thresholds
• Monitor performance
• Compare performance
variations
Guided Application Tuning with SQL
Advisors
Packaged
Apps
Customizable
Apps
High-load SQL
Automatic Tuning Optimizer
Auto SQL
Auto SQL
Access
Tuning
Analysis
Advisor
Packaged
Apps
+
SQL
Profile
Customizable
Apps
+
SQL
Advice
Customizable
Apps
+
Indexes, MVs,
Partitions
Well-tuned SQL
SQL Tuning & Access Advisors
• Automates SQL and application
tuning
• Performance benefit of advice
provided
• Recommendations include: new
indexes, partitions, MV’s,
statistics update, SQL
restructuring and SQL Profiling
• SQL Profiling tunes SQL
transparently without changing
application code
• Enables packaged application
tuning
Reactive Application Tuning with SQL
Tuning Advisor
SQL Tuning
Recommendations
Automatic Tuning Optimizer
Statistics
Analysis
SQL
Profiling
Access Path
Analysis
SQL Restructure
Analysis
New in11.2
New in11.2
Alternative Plan
Analysis
Parallel Query
Analysis
SQL Tuning
Advisor
Gather Missing or
Stale Statistics
Create a SQL Profile
Add Missing Access
Structures
Modify SQL
Constructs
Adopt Alternative
Execution Plan
Create Parallel
SQL Profile
DBA
What is SQL Profile?
Contains auxiliary information collected by the ATO for a
SQL statement
–
–
–
–
Customized optimizer settings
Compensation for missing or stale statistics
Compensation for errors in optimizer estimates
Parallel Query use
Doesn’t require any change to the SQL text
–
Only solution for Packaged Apps
Persistent: Works across shutdowns & upgrades
Transportable across databases (10.2)
SQL Profiling Flow
SQL Profiling
submit
create
Optimizer
(Tuning Mode)
SQL Tuning
Advisor
e
us
SQL
Profile
After …
output
submit
Optimizer
(Normal Mode)
Database
Users
Well-Tuned
Plan
SQL Tuning in Oracle Database 10g
End-to-End Workflow
Workload
Implement
Evaluate
Recommendations
DBA
DBA
Generate
Recommendations
one hour
DBA
ADDM
AWR
Invoke
Advisor
SQL Tuning Candidates
SQL Tuning
Advisor
A good end-to-end solution,
but manual intervention required
Automatic SQL Tuning in Oracle
Database 11g
Packaged
Apps
Custom
Apps
Auto Capture
High-Load SQL
Nightly
Automatic SQL Tuning
SQL
Profiles
Automatic
implement
SQL
Analysis
Report
Manually
implement
Well-tuned SQL
• Complete automation of SQL
tuning
• Automatically captures highload SQL
• Automatically tunes SQL
without changing application
by creating SQL Profiles
• Automatically implements
(optional) greatly improved
SQL plans
• Automatically reports analysis
• Automatically runs during
maintenance window
Automatic SQL Tuning in Oracle 11g
Implement
SQL Profiles
Test SQL Profiles
Workload
Generate
Recommendations
Choose
Candidate
SQL
SQL Tuning
Candidates
one
week
AWR
DBA
It’s Automatic!
View Reports /
Control
Process
Proactive Tuning with SQL Access
Advisor
Recommendations
SQL Access
Advisor
Automatic Tuning
Optimizer
Access Path
Analysis
B*-tree indexes
Bit-map indexes
Partitions (11g
only)
MV and MV Logs
DBA
SQL Access Advisor Features
• Recommends indexes, partitions (hash and interval only)
materialized views, and materialized view logs to create
and/or drop for faster performance
• Analyzes entire workload and not just independent SQL
statements
• Takes into account impact of new access structures on
DML operations
• Considers storage, creation and maintenance costs
• Simultaneously considers
•
•
•
index solutions
materialized view solutions
combinations of both
• Optimizes materialized views for
•
•
maximum query rewrite usage
fast refresh
<Insert Picture Here>
Conclusion
Reduce Administration Costs
Forrester Total Economical Impact study
DB-to-DBA ratio
75
65:1
50
25
Sample Org.
37:1
24:1
30:1
Industry Avg.
0
2007
2010
• DBA productivity savings: $509,339 (over a 3 year period)
• DBA labor savings
• Business productivity : $2,599,315 (over a 3 year period)
• Reduction in system downtime, and a corresponding increase in availability
• Capital expenditure savings (Servers): $552,000 (over a 3 year period)
• Reduced the CPU utilization of database servers
• Servers not purchased handling more workload with less resources
• ROI 122% and Payback 15 Months with EM Tuning and Diagnostic
Source: Forrester, The Total Economic Impact™ Of Oracle Enterprise Manager Database Management Packs Feb 2008
Use Database Tuning Technologies and …
Manage
• MORE databases
• MORE applications: OLTP, DW, OCS, iAS
• MORE users, larger databases
• MORE mission-critical applications
Become
• MORE proactive and strategic
• MORE important and valuable!
Get
• MORE sleep at night!
• MORE weekends off!