Collaborate 2019 - How to Understand an AWR Report
1. Session ID:
Prepared by:
Remember to complete your evaluation for this session within the app!
171
Listen to your database.
How to understand an Oracle AWR
report.
4/8/2019
Alfredo Krieg
Senior Cloud Performance Architect
Viscosity North America
@alfredokrieg
4. @ViscosityNAviscosityna.com
Viscosity is a team of experts specializing in
Oracle Cloud and Engineered Systems.
We are lot more than just Oracle
SharePlex Platinum Partner
MongoDB Consulting Partner
Neo4J Consulting Partner
Kyriba - Treasury Management
5. We’ve written 22 books on Data, Cloud, and Oracle…
Industry Experts
o Viscosity founders hold 27+ years each
in the Oracle space
o Authors of 22 books in the Oracle
space
o 5 ACE Directors, only 36 in the United
States. 1 Oracle ACE.
o Direct connections to Oracle support
and Product Managers support
o Expertise in Engineered Systems, ZFS,
ODA, Oracle 11g, 12c, 18c, RAC/ASM,
Data Guard, Performance Tuning &
Oracle Licensing
o Hire only best of the best
6. @ViscosityNAviscosityna.com 6
Viscosity Pillars
And Delivery Models
Database
InfrastructureAppsData
Data Integration
IAAS / PAAS
Data Warehousing
Analytics
GoldenGate
SAAS / PAAS
CX ERP SCM HCM
PAAS
Web Applications
Mobility
EBS / JDE / PS
IAAS
Public Cloud
Bare Metal Cloud
AWS Azure Bluemix
Engineered Systems
Exa- ZFS @Customer
X86 / Sparc
Workshops Assessments
Proof of
Concepts
Training Turnkey Projects
Managed
Services
7. @ViscosityNAviscosityna.com
Performance
Health Checks
How’s it running?
Apps
SaaS/PaaS,
Mobility, Application
Development
DBA
Services
Remote and
On-site
On-Call Support
Managed
Services
ZERO DOWNTIME
Migrations
Professional
Services
Where you need it most
Staff Aug
Workforce Capacity on
Demand
Oracle License Management
Get the most out of your Oracle
investment
7
12. Alfredo Krieg
• Oracle ACE
• Senior Cloud Performance Architect at Viscosity North America
• Database Performance Tuning, Exadata, OEM and EBS
• Oracle Technologies since 2004
• Blog www.alfredokriegdba.com
• alfredo.krieg@viscosityna.com
@alfredokrieg
13. Disclaimer
• The opinions expressed in this presentation are solely mine, and not that of my
employer.
• This is the method I use and could be other more efficient methods.
14. Agenda
• What is time?
• Why we use time?
• Time consumed VS time waited
• Is the DB system CPU-bound or I/O-bound?
• Where we should focus?
• What is a bottleneck?
• Identify TOP SQL
15. What it covers?
• Is my personal method
• It won’t cover how to tune SQL or DB parameters
• It won’t cover system statistics
• It covers how to quickly find a bottleneck
• How to find the TOP SQL responsible of the bottleneck
16. What is time?
• By looking at https://en.oxforddictionaries.com/definition/time
– The indefinite continued progress of existence and events in the
past, present, and future regarded as a whole.
– The continued progress of existence as affecting people and
things.
– The length of time taken to run a race or complete an event or
journey.
– British The moment at which the opening hours of a pub end.
– Baseball American Football A moment at which play stops
temporarily within a game. Photo by Jon Tyson on Unsplash
17. What is time?
• Alfredo’s definition:
“Is a measure in which an Oracle database process performs the requested work”
Photo by Lukas Blazek on Unsplash
18. Why we use time?
• Most human beings care about time
• We have machines that measure time
• Easy way to compare performance
• Oracle’s instrumentation is time based
19. Elapsed Time vs DB TIME
• Elapsed time is the amount of time (start-end) of the report
20. What is DB TIME?
• 'DB Time' is the amount of elapsed time (in microseconds) spent performing
Database user-level calls not including the elapsed time spent on instance
background processes such as PMON.
SELECT Round(NVL((e.value - s.value),-1)/60/1000000,2)||' minutes' "DB Time"
FROM DBA_HIST_SYS_TIME_MODEL s, DBA_HIST_SYS_TIME_MODEL e
WHERE s.snap_id = &AWRStartSnapID AND e.snap_id = &AWREndSnapID
AND e.dbid = s.dbid AND e.instance_number = s.instance_number
AND s.stat_name = 'DB time' AND e.stat_id = s.stat_id;
How Does Oracle Calculate the "DB time" & "Elapsed" Time Presented in AWR Report (Doc ID 1934757.1)
21. Time consumed VS time waited
• User’s sessions and background processes spend time in the database
• They have 2 status ACTIVE and INACTIVE
• If ACTIVE they can be consuming time on CPU or WAITING
Sessions
ACTIVE
INACTIVE
CPU
WAITING
DB_TIME
22. Time consumed VS time waited
• V$SESSION
– STATUS
• ACTIVE - Executing SQL
• INACTIVE
– KILLED
– SNIPED – Inactive waiting on client
• CACHED – Oracle X/Open Transaction Processing interface
– STATE
• NOT WAITING (CPU OR WAIT EVENT)
• WAITING (Typically not performing work)
– TYPE
• USER
• BACKGROUND
23. Time consumed VS time waited
• SELECT SID,EVENT FROM V$SESSION WHERE STATUS='ACTIVE' AND
STATE='WAITING' AND TYPE='USER';
SID EVENT
---------- ----------------------------------------------------------------
18 jobq slave wait
472 jobq slave wait
476 Streams AQ: waiting for messages in the queue
585 Streams AQ: waiting for messages in the queue
24. Time consumed VS time waited
• SELECT SID,EVENT FROM V$SESSION WHERE STATUS='ACTIVE' AND
STATE!='WAITING' AND TYPE='USER';
SID EVENT
---------- ----------------------------------------------------------------
2 direct path read
14 cell smart table scan
22 cell smart table scan
30 cell smart table scan
91 cell smart table scan
92 SQL*Net message to client
192 cell smart table scan
276 cell smart table scan
27. Where we should focus?
• Time Model Statistics is the answer
• Based on Oracle’s Instrumentation
• Calculates the time spent by each session and categorizes it in buckets
“Time model statistics use time to identify quantitative effects about specific
actions performed on the database, such as logon operations and parsing. The
most important time model statistic is database time, or DB time. This statistic
represents the total time spent in database calls and is an indicator of the total
instance workload. DB time is measured cumulatively from the time of instance
startup and is calculated by aggregating the CPU and wait times of all sessions
not waiting on idle wait events (non-idle user sessions).”
33. What is a bottleneck?
• Is the slowest operation is the set of operations
• In Oracle set of operations are called wait events
• Oracle’s instrumentation categorizes wait events into wait classes
• We make use of the wait interface (set of views) to access this data
• V$session_wait is the most useful
34. Can CPU be a bottleneck?
• Yes
• No easy way to reduce it apart of:
– Reduce the workload
– Buy more CPU power
• Kernel code execution burns CPU
– Even an I/O request
40. ASH?
• Alfredo, will this method also work with an ASH report?...... Kind of..
CPU 40%
Others 50.37% (28.23%+15.54%+4.67%+1.93%)
Don’t know the DB Time!!
41. Session ID:
Remember to complete your evaluation for this session within the app!
171
alfredo.krieg@viscosityna.com