Tips and Techniques for Maximizing Database Performance

Tips and Techniques for Maximizing Database Performance
Tips for Maximizing DB Performance
Theory and Practice
Mughees A. Minhas
Vice President, Product Management
Oracle
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.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
2
Program Agenda
1
Introduction
2
Oracle Database Performance Tuning Fundamentals
3
Performance Tuning Methodology
4
New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
3
Program Agenda
1
Introduction
2
Oracle Database Performance Tuning Fundamentals
3
Performance Tuning Methodology
4
New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
4
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)
Debug Code, Counters/Ratios,
BSTAT/ESTAT
Renaissance (v7): Introduction of
WAIT events, Moving from
Counters to Timers
Modernity (V10)
DB Time Tuning, ASH, AWR,
ADDM, EM
Grid Computing (V11)
ASH Analytics, RAC Aware ADDM,
Real-Time ADDM, Real-Time SQL
Monitoring, Active Reports, SQL
Performance Analyzer, Exadata
support
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Cloud (V12)
Multitenant-aware, In-memory
support, DB Operations
Monitoring, EM Express,
Performance Hub
Program Agenda
1
Introduction
2
Oracle Database Performance Tuning Fundamentals
3
Performance Tuning Methodology
4
New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
7
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.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
8
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
Books
Read Reviews
For One Book
Add to Cart
Checkout
= time spent in database
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
TIME
9
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
At time t we have 2 active sessions
User 1
User 2
User 3
= time spent in database
t
TIME
User n
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
10
Visualizing DB Time
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
11
Quiz
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. |
12
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. | Oracle Confidential – Internal/Restricted/Highly Restricted
13
Program Agenda
1
Introduction
2
Oracle Database Performance Tuning Fundamentals
3
Performance Tuning Methodology
4
New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
14
Performance Tuning Methodology
Proactive Performance Management
Reactive Performance Management
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
15
Proactive Performance Management: SPA Quick Check
• Helps users predict the impact of routine
system changes on production SQL
workload
SQL Plans + Statistics
SQL Plans + Statistics
• 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
Pre-change Trial
Post-change Trial
Compare SQL
Performance
Analysis Report
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
16
Proactive Performance Management
Predict the impact of routine system changes on SQL workload response time
• Optimized
SPA Quick Check
– Optimized for use on prod systems
– Optimal Trial or Explain Plan mode
– Disable multi-executions, full DML execute disabled
Optimal Trial
Mode, no DML
execute
• Controlled
Optimized
Controlled/Sc
oped
Per SQL Time Limits,
Limits testing scope to
private session
– Per SQL time limits
– Testing scoped to private session
Change-Aware
Context-aware
change testing
– Associate with Resource Consumer Group
• Change-Aware
– Context-aware change testing workflows, such as,
– Optimizer gather statistics
– Init.ora parameter changes
Pre-selected
STS and
default SPA
settings
Production
Database
DBA
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
17
Proactive Performance Management
Predict the impact of system changes on SQL workload response time
3
2
1
5
4
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
18
Performance Tuning Methodology
Reactive Performance Management
• 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. | Oracle Confidential – Internal/Restricted/Highly Restricted
19
Reactive Performance Management
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. | Oracle Confidential – Internal/Restricted/Highly Restricted
20
Reactive Performance Management
• 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?
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
21
Reactive Performance Management
Analyzing transient performance problems using ASH Analytics
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
22
ASH Analytics identifies User I/O as the problem
Identify SQL’s that are subject to User I/O
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
23
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
Database Performance Hub provides holistic performance management
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
32
Database Performance Hub
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. |
33
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
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
34
Program Agenda
1
Introduction
2
Oracle Database Performance Tuning Fundamentals
3
Performance Tuning Methodology
4
New Features
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
36
AWR and Multitenant: Background and Challenges
• Single AWR repository per database
AWR Architecture (pre-DB12.2)
– For non-CDB resides in SYSAUX
– For CDB resides in Root’s SYSAUX (12.1)
Internal Clients
• AWR does not have notion of AWR
data for a PDB (no Top N per PDB)
• Partial AWR statistics
Automatic Workload
Repository (AWR)
– Missing Time-Wait model, sysmetrics statistics
per PDB
– No break down per PDB level at root
• AWR data not transportable along
with PDB
Self Tuning
Components
ADDM
MMON Process
In Memory
Statistics
Foreground
Processes
SGA
DBA_HIST Views
OEM
V$ Views
Background
Processes
SQL*Plus
External Clients
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal
37
AWR Enhancements for Multitenant
• CDB Level Snapshot Support
• PDB Level Snapshot Support
• Same functionality as in Oracle Database 12.1
• Per PDB AWR with autonomous retention and
snapshot settings
– 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
• Performance data for PDB stored in local SYSAUX
– Snapshots contains data from PDB level v$ views
– 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
• Both manual and automatic snapshots supported
– Automatic snapshots disabled by default, enable
selectively
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
40
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
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
42
AWR Unified Manageability Framework topology
Source databases
Primary
DB2
Active Data Guard
ADG
DB4
DB3
DB1
Remote database could be a Primary
and its ADG or any other generic
database
db_link_to_target
DB5
DBID1
AWR Data
DBID2
AWR Data
Remote
AWR Data
Store
db_link_to_sources
Catalog of registered remote databases
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
43
Remote Snapshot Configuration for ADG Database
ADG Reader Farm
Primary
Active Data Guard
3. Define the source databases
Local AWR Data
Source databases
4. Define the target database
5. Create the topology
Remote AWR Data
Catalog database
6. Register the source databases
7. Register the source databases for AWR service
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
44
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
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
48
SQL Tuning Advisor Support for Active Data Guard
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. | 49
SQL Tuning Advisor Support for Active Data Guard
Primary
Standby
Active Data Guard
dblink_to_primary
1a. create_tuning_task : create a tuning task
1b. Write data about the task
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
50
SQL Tuning Advisor Support for Active Data Guard
Primary
Standby
Active Data Guard
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
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
51
SQL Tuning Advisor Support for Active Data Guard
Primary
Standby
Active Data Guard
dblink_to_primary
3a. report_tuning_task: Fetch data from
primary to produce and create a tuning
report
3b. Execute: accept_sql_profile
3c. Write accepted profile
results to disk
3d. Accepted profile available via redo apply
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
52
Performance Tuning Methodology: Summary
Proactive Performance
Management
Reactive Performance
Management
– SQL Performance Analyzer
Quick Check
–
–
–
–
–
–
ASH Analytics
ADDM
Real- Time ADDM
Real-Time SQL Monitoring
SQL Tuning Advisor
Performance Hub for
holistic management
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
53
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted
54
Was this manual useful for you? yes no
Thank you for your participation!

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

Download PDF

advertisement