Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Oracle Confidential – Internal/Restricted/Highly Restricted 2
Tips and Techniques for Maximizing Database Performance Theory and Practice
Sriram Vrinda, Prabhaker Gongloor Product Management Database and Systems Manageability October, 2015
Oracle Confidential – Internal/Restricted/Highly Restricted Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Oracle Database Performance Tuning Fundamentals
Performance Tuning Methodology
New Features
1
2
3
4
Oracle Confidential – Internal/Restricted/Highly Restricted 4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Oracle Database Performance Tuning Fundamentals
Performance Tuning Methodology
New Features
1
2
3
4
Oracle Confidential – Internal/Restricted/Highly Restricted 5
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Top Challenges: Database Management
52% Rapid diagnoses of database
performance problems
45% Identifying application (SQL)
issues
37% Validating and applying SQL
tuning solutions
Key Takeaway: Improve & Ensure Higher Quality of Service
?
Source: THE RAPIDLY ACCELERATING CLOUD-ENABLED ENTERPRISE: 2015 IOUG Survey On Database Manageability
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Dark Ages (V5-V7) Modernity (V10) Grid Computing (V11) Cloud (V12)
Debug Code, Counters/Ratios, BSTAT/ESTAT Renaissance (v7): Introduction of WAIT events, Moving from Counters to Timers
DB Time Tuning, ASH, AWR, ADDM, EM
ASH Analytics, RAC Aware ADDM, Real-Time ADDM, Real-Time SQL Monitoring, Active Reports, SQL Performance Analyzer, Exadata support
Multitenant-aware, In-memory support, DB Operations Monitoring, EM Express, Performance Hub
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Oracle Database Performance Tuning Fundamentals
Performance Tuning Methodology
New Features
1
2
3
4
Oracle Confidential – Internal/Restricted/Highly Restricted 8
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
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.
Oracle Confidential – Internal/Restricted/Highly Restricted 9
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
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
Oracle Confidential – Internal/Restricted/Highly Restricted 10
Browse
Books
Read Reviews
For One Book Add to Cart Checkout
TIME = time spent in database
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Multiple Sessions
• DB Time = Sum of DB Time Over All Sessions
• Avg. Active Sessions = Sum of Avg. Activity Over All Sessions
= Sum(DB Time) / Elapsed Time
Oracle Confidential – Internal/Restricted/Highly Restricted 11
= time spent in database
TIME
User 1
User 2
User 3
User n
t
At time t we have 2 active sessions
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Visualizing DB Time
Oracle Confidential – Internal/Restricted/Highly Restricted 12
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Quiz
13
An AWR report of snapshots taken between 15 minutes shows DB Time greater than 15 minutes. How is this possible?
• DB Time is the time spent in the database: Includes CPU time, IO time and non-idle wait time
• You have more than one session contributing to the "time" of the database.
• If you have 2 cpus, you have 2 cpu seconds per every 'real second’
• How can you have 30 minutes of enqueue wait in 15 minutes?
• Easy - 30 sessions waited one minute apiece, or two sessions waited 15 minutes or ......
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 14
Where to find DB time: EM Performance page
• Active Sessions by wait class over time
• Colored area = Amount of DB time, More the DB time, More the Problem
• DB time increases as system load increases , DB time increases as system performance degrades.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Oracle Database Performance Tuning Fundamentals
Performance Tuning Methodology
New Features
1
2
3
4
Oracle Confidential – Internal/Restricted/Highly Restricted 15
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Performance Tuning Methodology
Proactive Performance Management Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 16
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• Helps users predict the impact of routine system changes on production SQL workload
• Low overhead capture of SQL workload to SQL Tuning Set (STS)
• Build different SQL trials (experiments) of SQL statements performance by test execution or explain plan
• Day to day use cases integrated with SPA Quick Check, SQL Plan Baselines, & SQL Tuning Advisor to form an end-to-end solution
Oracle Confidential – Internal/Restricted/Highly Restricted 17
Proactive Performance Management: SPA Quick Check
Analysis Report
Compare SQL Performance
Post-change Trial Pre-change Trial
SQL Plans + Statistics SQL Plans + Statistics
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• Optimized – Optimized for use on prod systems
– Optimal Trial or Explain Plan mode
– Disable multi-executions, full DML execute disabled
• Controlled – Per SQL time limits
– Testing scoped to private session
– Associate with Resource Consumer Group
• Change-Aware – Context-aware change testing workflows, such as,
– Optimizer gather statistics
– Init.ora parameter changes
Oracle Confidential – Internal/Restricted/Highly Restricted 18
Proactive Performance Management Predict the impact of routine system changes on SQL workload response time
SPA Quick Check
Production Database
Optimized Controlled/Sc
oped
Change-Aware
Optimal Trial
Mode, no DML
execute
Pre-selected
STS and
default SPA
settings
Per SQL Time Limits,
Limits testing scope to
private session
Context-aware
change testing
DBA
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Proactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 19
Predict the impact of system changes on SQL workload response time
1
2
3
4
5
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Performance Tuning Methodology Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 20
• Analyzing transient performance problems – ASH Analytics
• Diagnose persistent performance issues – ADDM
• In-depth SQL performance analysis – Real-Time SQL Monitoring
• Optimizing top SQL’s with sub-optimal plans – SQL Tuning Advisor
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 21
Identify performance issues using ASH Analytics
– Graphical ASH report for advanced analysis
– Provides visual filtering for recursive drill-downs
– Select any time period for analysis
– Analyze performance across many dimensions
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• I am a CDBA and asked to investigate transient performance issues reported by one application owner. I need to diagnose the cause of these issues and address them
• AWR report indicates some unusual
issues on the system – But I don’t get a PDB specific report…
– What to do next?
Oracle Confidential – Internal/Restricted/Highly Restricted 22
Reactive Performance Management
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
23
Analyzing transient performance problems using ASH Analytics
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
ASH Analytics identifies User I/O as the problem
24
Identify SQL’s that are subject to User I/O
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 25
Diagnose persistent performance issues
Real-Time ADDM
Compare Period ADDM ADDM
Enhanced Real-Time
ADDM
• Diagnose persistent performance issues
• Analyzes AWR snapshots
• Regular interval
• Automatic / Manual
• In-depth performance comparison across two periods
• Relies on AWR data
• Manual
• Hung or extremely slow databases
• Uses a normal and diagnostic mode connection
• Manual
• Proactively detect & diagnose transient high-impact problems
• Built inside the DB
• Automatically runs every 3 seconds
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• My database is unresponsive and end-users are complaining of performance issues. Should I bounce the database or wait for some time for problem to go away?
• Database Hung state
Blocking Sessions
Memory allocation issues
Library cache issues
Unresponsive Storage (ASM)
Interconnect problems
Oracle Confidential – Internal/Restricted/Highly Restricted 26
Reactive Performance Management
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 28
Diagnose hung database issues using Real-Time ADDM
• Identify the problem area
• Turns out to be a SQL that consumes significant amount of DB Time
• Review SQL Monitor report of the problem SQL for in-depth analysis
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 29
Diagnose SQL Performance using Real-Time SQL Monitoring
• The SQL ran for a period of 5 minutes and created the spike
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 30
Diagnose SQL Performance using SQL Details Active Report
• Multiple sessions trying to read the same block over and over
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 31
Diagnose Hung database issues using Real-Time ADDM
• Refer back to Real-Time ADDM to nail this down as login storm issue, understand more about this query
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Reactive Performance Management
Oracle Confidential – Internal/Restricted/Highly Restricted 32
How to go about tuning the sub-optimal SQL?
32
Statistics Analysis
SQL Profiling
Access Path Analysis
SQL Restructure Analysis
Alternative Plan Analysis
Parallel Query Analysis
Automatic Tuning Optimizer
Administrator
Comprehensive SQL Tuning Recommendations
Gather Missing or Stale Statistics
Create a SQL Profile
Add Missing Access Structures
Modify SQL Constructs
Adopt Alternative
Execution Plan
Create Parallel SQL Profile
SQL Tuning Advisor
• Gives recommendations on various problems found during analysis phase
• Uses the same CBO but has more time budget for comprehensive analysis
• Identifies alternate execution plans using real time and historical performance data
• Recommends SQL profile to compensate for incorrect statistics and transparently improve performance
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Which Database Performance Diagnostics Tool to Use?
• Automatic Workload Repository – AWR Reports
– Reports about performance and workload data from AWR
• Active Session History – ASH
– Gathers fine-grain data about every active database session every second
• Automatic Database Diagnostics Monitor - ADDM
– Data Analysis and Problem Identification
– Findings and Advise on how best to resolve bottlenecks
• Real-time SQL and Database Operations Monitoring
– Provides in-depth diagnostics about SQL execution at row source level
33
Database Performance Hub provides holistic performance management
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Database Performance Hub
34
Holistic Performance Management
• Single view of DB performance
– ADDM, SQL Tuning, Real-Time SQL Monitoring, ASH Analytics
• Switch between ASH analytics, workload view, ADDM findings and SQL monitoring seamlessly
• Supports both real-time & historical mode
• Historical view of SQL Monitoring reports
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Performance Hub Report
• New interactive report for analyzing AWR data
• Performance Hub report generated from SQL*Plus
– @$ORACLE_HOME/rdbms/admin/perfhubrpt.sql
OR calling dbms_perf.report_perfhub(….) function
– Single view of DB performance
– ADDM, SQL Tuning, Real-Time SQL Monitoring, ASH Analytics
• Switch between ASH analytics, workload view, ADDM findings and SQL monitoring seamlessly
• Supports both real-time & historical mode
• Historical view of SQL Monitoring reports
35
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Oracle Database Performance Tuning Fundamentals
Performance Tuning Methodology
New Features
1
2
3
4
Oracle Confidential – Internal/Restricted/Highly Restricted 37
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
• Single AWR repository per database – For non-CDB resides in SYSAUX
– For CDB resides in Root’s SYSAUX (12.1)
• AWR does not have notion of AWR data for a PDB (no Top N per PDB)
• Partial AWR statistics – Missing Time-Wait model, sysmetrics statistics
per PDB
– No break down per PDB level at root
• AWR data not transportable along with PDB
Oracle Confidential – Internal 38
AWR and Multitenant: Background and Challenges
MMON Process
SGA
In Memory Statistics
DBA_HIST Views V$ Views
Foreground Processes
ADDM
Self Tuning
Components
Internal Clients
OEM SQL*Plus
External Clients
Background Processes
Automatic Workload
Repository (AWR)
AWR Architecture (pre-DB12.2)
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
AWR Architecture for Multitenant Per -PDB AWR Support
AW
R
AWR AWR AWR
AWR AWR
PDBs
Root
CDB
Multitenant Container Database
AW
R
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
AWR Enhancements for Multitenant
• CDB Level Snapshot Support
• Same functionality as in Oracle Database 12.1
– CDB snapshots will be taken at the Root and stored at the Root’s SYSAUX
– Same default settings – automatic snapshots at every hour, retention period of 8 days
– Automatic snapshots ON by default
• Enhanced content
– More PDB-specific stats are collected and exposed via v$con_sysstats, v$con_sysmetric, v$con_sys_time_model
Oracle Confidential – Internal/Restricted/Highly Restricted 41
• PDB Level Snapshot Support
• Per PDB AWR with autonomous retention and snapshot settings
• Performance data for PDB stored in local SYSAUX
– Snapshots contains data from PDB level v$ views
• Both manual and automatic snapshots supported
– Automatic snapshots disabled by default, enable selectively
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
AWR Support for Remote Snapshots and ADG
• Problem
– AWR snapshots cannot be taken in a read-only standby environment
– Performance monitoring and analysis is limited to basic STATSPACK functionality
• Solution – In Oracle Database 12.2, AWR framework enhanced to support capture of remote
snapshots from any generic database including Active Data Guard (ADG) databases. • A target catalog database collects snapshots from the remote databases (sources)
• Snapshots can be collected automatically or manually
• AWR tables on the catalog database accumulate snapshot data from all sources via database links
• Source databases must be registered on the catalog via new DBMS_WORKLOAD_REPOSITORY.REGISTER_REMOTE_DATABASE API
Oracle Confidential – Internal/Restricted/Highly Restricted 43
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
AWR Unified Manageability Framework topology
Oracle Confidential – Internal/Restricted/Highly Restricted 44
Source databases
Active Data Guard
Remote AWR Data
Store
Catalog of registered remote databases
Remote database could be a Primary and its ADG or any other generic
database
DBID1 AWR Data
DBID2 AWR Data
ADG
DB5
Primary
db_link_to_sources
db_link_to_target
DB1
DB3 DB4 DB2
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Remote Snapshot Configuration for ADG Database
Oracle Confidential – Internal/Restricted/Highly Restricted 45
Primary
Local AWR Data
Catalog database
Remote AWR Data
ADG Reader Farm
Source databases
Active Data Guard 3. Define the source databases
4. Define the target database
5. Create the topology
6. Register the source databases
7. Register the source databases for AWR service
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor Support for Active Data Guard
• Problem
– ADG databases are widely used to offload reporting or ad hoc query-only jobs from primary
– Reporting workload profile is different from primary and often requires tuning
• Solution • Oracle Database 12.2 introduces the ability to tune SQLs workloads running on ADG database
• All SQL Tuning Advisor tasks issued at the standby
– Create tuning task, execute tuning task and implement SQL Profile recommendations can be run on standby
– Test execution (heavy lifting) happens on standby, only minimal write related activity on primary
• The required data for the above tasks are fetched from primary over a database link from standby
• Task details and tuning results are stored at primary and the essential data required to construct the report is accessed remotely from primary
• The report is constructed locally at the standby, with no CPU overhead in primary
Oracle Confidential – Internal/Restricted/Highly Restricted 49
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor Support for Active Data Guard
50
Primary Standby
dblink_to_primary
create tuning task execute tuning task report tuning task implement recommendations
– All changes are done on primary and propagated from primary to standby by redo apply
– Support for PDB level tuning
– The tuning task is executed at the standby, with no CPU overhead in primary
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor Support for Active Data Guard
Oracle Confidential – Internal/Restricted/Highly Restricted 51
Primary Standby
dblink_to_primary 1a. create_tuning_task : create a tuning task
1b. Write data about the task
Active Data Guard
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor Support for Active Data Guard
Oracle Confidential – Internal/Restricted/Highly Restricted 52
Primary Standby
dblink_to_primary
2a. execute_tuning_task : Fetch data from primary to execute a task 2b. Execute tuning analysis process
2c. Write tuning results to disk
Active Data Guard
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor Support for Active Data Guard
Oracle Confidential – Internal/Restricted/Highly Restricted 53
Primary Standby
dblink_to_primary
3a. report_tuning_task: Fetch data from primary to produce and create a tuning report
3c. Write accepted profile results to disk
3b. Execute: accept_sql_profile
3d. Accepted profile available via redo apply
Active Data Guard
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Performance Tuning Methodology: Summary
Proactive Performance Management
– SQL Performance Analyzer Quick Check
Reactive Performance Management
– ASH Analytics
– ADDM
– Real- Time ADDM
– Real-Time SQL Monitoring
– SQL Tuning Advisor
– Performance Hub for holistic management
Oracle Confidential – Internal/Restricted/Highly Restricted 54
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal 55
Classroom Training
Learning Subscription
Live Virtual Class
Training On Demand
Keep Learning with Oracle University
education.oracle.com
Cloud
Technology
Applications
Industries
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Session Surveys
Help us help you!! • The [Program Committee J1] [organizing committee OW] would like to
invite you to take a moment to give us your session feedback. Your feedback will help us to improve your conference.
• Please be sure to add your feedback for your attended sessions by using the Mobile Survey or in Schedule Builder.
Oracle Confidential – Internal/Restricted/Highly Restricted 56
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 57