SlideShare a Scribd company logo
6
Most read
8
Most read
18
Most read
Part 1 : What, When and How Virtathon   7/2011 Uday Moogala Vlado Barun
Uday Moogala Sr. Principal Engineer with Oracle Apps Development 15 years in the Oracle Database arena Vlado Barun, M.Sc. Sr. Principal Performance Engineer with Oracle Cloud Services OCP, OCE  SQL, MCP 15 years in the Database Arena (Oracle - 10 years) Who we are
All the views expressed in this presentation are  the opinion of the authors and do not necessarily reflect the views of Oracle America, Inc. The queries are provided "as is", without  warranty of any kind, expressed or implied.  Disclaimer
How to approach a SQL performance issue   What diagnostic data to gather   Generating and interpreting  AWR Report ASH Reports  SQL Execution Plans  Real-Time SQL Monitoring Reports Agenda
In order to know what to fix, we need to be able to  see  what’s broken! - Dan Roam
What Identify (app is slow) Quantify (takes 1m) Timeline (in peak hours) Component (MT or DB or N/W) Flow chart Root Cause (Stats not updated) AWR/ASH, Trace, Apps Logs/Tables, OS/IO stats etc SQL/Object Stats,  Execution Plans, etc Initial Data collec-tion How Much When Where How Why Analyze Additional Data collec-tion Understanding the issue…
Non-DB Time DB Time Getting to know the System…
An example… I/O On CPU I/O On CPU Browse  Books Read Reviews For One Book Add to Cart Checkout TIME =  time spent in database =  user/network/app tier time
=  time spent in database SQL Trace (Microsecond level) Application Logging (custom level) Gathering Performance Data… (SQL Trace, ASH) 21 ASH Samples 3 ASH Samples in AWR Browse  Books Read Reviews For One Book Add to Cart Checkout TIME v$active_session_history (1 second intervals) dba_hist_active_sess_history (10 second intervals)
Automatic Workload Repository (AWR) Collects database performance statistics - Objects (access and usage statistics) SQL Statement statistics Wait events statistics System statistics ASH Statistics  ( DBA_HIST_ACTIVE_SESS_HISTORY ) Time Model Statistics based on time usage for activities Every 1 hr by default Stored in  DBA_HIST%   views How to access? $ORACLE_HOME/rdbms/admin/awrrpt.sql OEM Other tools Sample output
Active Session History (ASH) Samples the current state of all  active  sessions - 1 second samples - Stores various attributes (dimensions) of a session Stored in  V$ACTIVE_SESSION_HISTORY  1-second sampling rate DBA_HIST_ACTIVE_SESS_HISTORY  Sub-sampling to disk into AWR Snapshot 1-in-10 samples How to access? $ORACLE_HOME/rdbms/admin/ashrpt.sql, ashrpti.sql OEM Other tools Sample output
Active Session History (ASH) -  Dimensions When SAMPLE_ID SAMPLE_TIME Session SESSION_ID SESSION_SERIAL# SESSION_TYPE SESSION_STATE USER_ID QC_INSTANCE_ID QC_SESSION_ID QC_SESSION_SERIAL# CLIENT_ID IN and IS columns SQL SQL_ID IS_SQLID_CURRENT SQL_CHILD_NUMBER SQL_OPCODE SQL_OPNAME TOP_LEVEL_SQL_ID TOP_LEVEL_SQL_OPCODE SQL_EXEC_ID SQL_EXEC_START SQL_PLAN_HASH_VALUE SQL_PLAN_OPTIONS Row Source SQL_PLAN_LINE_ID SQL_PLAN_OPERATION Waits   EVENT EVENT_ID EVENT# SEQ# P1TEXT P1 P2TEXT P2 P3TEXT P3 WAIT_CLASS WAIT_CLASS_ID WAIT_TIME TIME_WAITED CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# CURRENT_ROW# Blocking Session BLOCKING_SESSION_STATUS BLOCKING_SESSION BLOCKING_SESSION_SERIAL# BLOCKING_INST_ID BLOCKING_HANGCHAIN_INFO Object CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# CURRENT_ROW# Application SERVICE_HASH PROGRAM MODULE ACTION MACHINE Statistics TM_DELTA_TIME TM_DELTA_CPU_TIME TM_DELTA_DB_TIME DELTA_TIME DELTA_READ_IO_REQUESTS DELTA_WRITE_IO_REQUESTS DELTA_READ_IO_BYTES DELTA_WRITE_IO_BYTES DELTA_INTERCONNECT_IO_BYTES PGA_ALLOCATED TEMP_SPACE_ALLOCATED
SQL Execution Plans DBMS_XPLAIN. DISPLAY_CURSOR Plan is from memory Predicates and outline data most useful when ‘statistics_level’ set to ALL or with gather_plan_statistics hint Sample output DBMS_XPLAIN. DISPLAY_AWR Plan is from AWR (DBA_HIST% views) Runtime (actual) stats are not displayed Sample output Sample output
select * from table(dbms_xplan.display_cursor('&SQL_ID',null,'ALLSTATS LAST')); SQL_ID  0s5pdsggxtc54, child number 0 ------------------------------------- Plan hash value: 2832870632 ---------------------------------------------------------------------------- | Id  | Operation  | Name  | Rows  | Bytes | Cost (%CPU)| Time  | ---------------------------------------------------------------------------- |  0 | SELECT STATEMENT  |  |  |  |  152K(100)|  | |  1 |  SORT AGGREGATE  |  |  1 |  2 |  |  | |*  2 |  TABLE ACCESS FULL| TAB_A |  21M|  41M|  152K  (5)| 00:00:03 | ---------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("COSTED_FLAG" IS NULL) Note ----- - Warning: basic plan statistics not available. These are only collected when: * hint 'gather_plan_statistics' is used for the statement or * parameter 'statistics_level' is set to 'ALL', at session or system level Display_Cursor Estimates with Statistics_level = Typical SQL_ID  0s5pdsggxtc54, child number 1 ------------------------------------- Plan hash value: 2832870632 -------------------------------------------------------------------------------------- | Id  | Operation  | Name  | Starts | E-Rows | A-Rows |  A-Time  | Buffers | -------------------------------------------------------------------------------------- |  0 | SELECT STATEMENT  |  |  1 |  |  1 |00:00:01.73 |  435K| |  1 |  SORT AGGREGATE  |  |  1 |  1 |  1 |00:00:01.73 |  435K| |*  2 |  TABLE ACCESS FULL| TAB_A |  1 |  1351K|  2001K|00:00:01.64 |  435K| -------------------------------------------------------------------------------------- Actual runtime stats with Statistics_level =  ALL or with gather_plan_statistics hint
Display_AWR SQL_ID 0s5pdsggxtc54 -------------------- ---------------------------------------------------------------------------- | Id  | Operation  | Name  | Rows  | Bytes | Cost (%CPU)| Time  | ---------------------------------------------------------------------------- |  0 | SELECT STATEMENT  |  |  |  | 22217 (100)|  | |  1 |  SORT AGGREGATE  |  |  1 |  2 |  |  | |  2 |  TABLE ACCESS FULL| TAB_A |  1351K|  2639K| 22217  (1)| 00:04:27 | ----------------------------------------------------------------------------
Real-Time SQL Monitoring Monitors SQLs while they are running Automatically monitors parallel SQLs and SQLs taking more than 5 CPU seconds Plan is from memory Predicates CPU and Elapsed Time No. of reads and writes Waits Stored in  V$SQL_MONITOR  and  V$SQL_PLAN_MONITOR  views How to access? DBMS_SQLTUNE.REPORT_SQL_MONITOR Enterprise Manager Sample output
Summary AWR Report  Identified SQL issue Get report snapshots as close as possible to the issue ASH Report - At system level to identify the session At session level to identify the SQL At SQL level to identify the row source, object, and wait events Analyze samples taken during problematic SQL execution SQL Execution Plans Dbms_Xplain.Display_Cursor Dbms_Xplain.Display_AWR set  STATISTICS_LEVEL  to ‘ ALL ’ or put  GATHER_PLAN_STATISTICS  hint Real-Time SQL Monitoring Report To monitor the long running or parallel SQL Take several reports and analyze the issue
SQL Tuning Trace files SQLT output (MOS Doc: 215187.1) Trace Analyzer (MOS Doc : 224270.1) AWR Report (MOS Doc : 748642.1) AWR SQL Report (awrsqrpt.sql) 11g Real-Time SQL Monitoring  SQL Tuning Advisor PL/SQL Tuning Product logs PL/SQL Profiler (MOS Doc : 808005.1) Forms Tuning Forms Tracing (MOS Doc : 373548.1) Generic MOS Doc : 438652.1 Reports Tracing MOS Doc: 111311.1 Database Tuning AWR Report (MOS Doc : 748642.1) ADDM report (MOS Doc : 250655.1) Active Session History (ASH) Report  LTOM output (MOS Doc : 352363.1)  Middletier Tuning JVM Logs Third Party Tools OS OSWatcher (MOS Doc : 301137.1)  Reference
Reference Performance Fundamentals for Oracle Database 10g and 11g by  Graham Wood and John Beresniewicz (http://www.oracle.com/technetwork/database/focus-areas/manageability/db-perf-tuning-ow08-131582.pdf ) ASH - Active Session History (https://sites.google.com/site/embtdbo/wait-event-documentation/ash---active-session-history)
Q & A

More Related Content

What's hot (20)

PDF
TFA Collector - what can one do with it
Sandesh Rao
 
PDF
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Tanel Poder
 
PPTX
Part1 of SQL Tuning Workshop - Understanding the Optimizer
Maria Colgan
 
PPT
Using Statspack and AWR for Memory Monitoring and Tuning
Texas Memory Systems, and IBM Company
 
PPTX
Explain the explain_plan
Maria Colgan
 
DOC
Analyzing awr report
satish Gaddipati
 
PPTX
Oracle AWR Data mining
Yury Velikanov
 
PDF
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Aaron Shilo
 
PDF
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Zohar Elkayam
 
PPTX
Using AWR/Statspack for Wait Analysis
Texas Memory Systems, and IBM Company
 
PPTX
SQL Tuning, takes 3 to tango
Mauro Pagano
 
PDF
AWR Ambiguity: Performance reasoning when the numbers don't add up
John Beresniewicz
 
PDF
SQL Monitoring in Oracle Database 12c
Tanel Poder
 
PDF
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
PPT
Ash masters : advanced ash analytics on Oracle
Kyle Hailey
 
PDF
AWR & ASH Analysis
aioughydchapter
 
PPT
Direct SGA access without SQL
Kyle Hailey
 
PDF
Oracle statistics by example
Mauro Pagano
 
PDF
Oracle Client Failover - Under The Hood
Ludovico Caldara
 
PPT
Oracle 10g Performance: chapter 02 aas
Kyle Hailey
 
TFA Collector - what can one do with it
Sandesh Rao
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Tanel Poder
 
Part1 of SQL Tuning Workshop - Understanding the Optimizer
Maria Colgan
 
Using Statspack and AWR for Memory Monitoring and Tuning
Texas Memory Systems, and IBM Company
 
Explain the explain_plan
Maria Colgan
 
Analyzing awr report
satish Gaddipati
 
Oracle AWR Data mining
Yury Velikanov
 
Exploring Oracle Database Performance Tuning Best Practices for DBAs and Deve...
Aaron Shilo
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Zohar Elkayam
 
Using AWR/Statspack for Wait Analysis
Texas Memory Systems, and IBM Company
 
SQL Tuning, takes 3 to tango
Mauro Pagano
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
John Beresniewicz
 
SQL Monitoring in Oracle Database 12c
Tanel Poder
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
Ash masters : advanced ash analytics on Oracle
Kyle Hailey
 
AWR & ASH Analysis
aioughydchapter
 
Direct SGA access without SQL
Kyle Hailey
 
Oracle statistics by example
Mauro Pagano
 
Oracle Client Failover - Under The Hood
Ludovico Caldara
 
Oracle 10g Performance: chapter 02 aas
Kyle Hailey
 

Viewers also liked (20)

PPTX
Oracle Oracle Performance Tuning
Kernel Training
 
PPTX
Top 10 tips for Oracle performance (Updated April 2015)
Guy Harrison
 
PPTX
Oracle database performance tuning
Yogiji Creations
 
PPTX
Oracle sql high performance tuning
Guy Harrison
 
PDF
Reading AWR or Statspack Report - Straight to the Goal
Franck Pachot
 
PDF
Oracle SQL Performance Tuning and Optimization v26 chapter 1
Kevin Meade
 
PDF
Oracle db performance tuning
Simon Huang
 
PPTX
Oracle DB Performance Tuning Tips
Asanka Dilruk
 
PPSX
Oracle Performance Tuning Fundamentals
Carlos Sierra
 
PDF
Ash and awr performance data2
Kellyn Pot'Vin-Gorman
 
PDF
Oracle Diagnostics : Latches and Enqueues
Hemant K Chitale
 
PDF
AWR, ASH with EM13 at HotSos 2016
Kellyn Pot'Vin-Gorman
 
PPT
Aioug sangam13 v3
pasalapudi
 
PDF
Installation and configuration 11g r2 asm using job role separation(grid & or...
Zhaoyang Wang
 
PDF
Deploying Oracle 11g R2 on Linux RHEL6
Mc Cloud
 
PPTX
Resume
Mahaveer Jain
 
PPTX
Exalogic Technical Overview
Andrey Akulov
 
PPT
Sql DML
Vikas Gupta
 
PDF
Oracle database 12c intro
pasalapudi
 
PDF
Oracle RAC 12c and Policy-Managed Databases, a Technical Overview
Ludovico Caldara
 
Oracle Oracle Performance Tuning
Kernel Training
 
Top 10 tips for Oracle performance (Updated April 2015)
Guy Harrison
 
Oracle database performance tuning
Yogiji Creations
 
Oracle sql high performance tuning
Guy Harrison
 
Reading AWR or Statspack Report - Straight to the Goal
Franck Pachot
 
Oracle SQL Performance Tuning and Optimization v26 chapter 1
Kevin Meade
 
Oracle db performance tuning
Simon Huang
 
Oracle DB Performance Tuning Tips
Asanka Dilruk
 
Oracle Performance Tuning Fundamentals
Carlos Sierra
 
Ash and awr performance data2
Kellyn Pot'Vin-Gorman
 
Oracle Diagnostics : Latches and Enqueues
Hemant K Chitale
 
AWR, ASH with EM13 at HotSos 2016
Kellyn Pot'Vin-Gorman
 
Aioug sangam13 v3
pasalapudi
 
Installation and configuration 11g r2 asm using job role separation(grid & or...
Zhaoyang Wang
 
Deploying Oracle 11g R2 on Linux RHEL6
Mc Cloud
 
Exalogic Technical Overview
Andrey Akulov
 
Sql DML
Vikas Gupta
 
Oracle database 12c intro
pasalapudi
 
Oracle RAC 12c and Policy-Managed Databases, a Technical Overview
Ludovico Caldara
 
Ad

Similar to Performance Tuning With Oracle ASH and AWR. Part 1 How And What (20)

PPSX
Barun_Practical_and_Efficient_SQL_Performance_Tuning
Vlado Barun
 
PDF
Ash and awr deep dive hotsos
Kellyn Pot'Vin-Gorman
 
PPTX
ASH and AWR on DB12c
Kellyn Pot'Vin-Gorman
 
PDF
Donatone_Grid Performance(2)11111111.pdg
cookie1969
 
PPTX
Oracle Database Performance Tuning Basics
nitin anjankar
 
PPTX
Further Adventures With ASH
David Kurtz
 
PPTX
Kellyn Pot'Vin-Gorman - Awr and Ash
gaougorg
 
PDF
Sherlock holmes for dba’s
Kellyn Pot'Vin-Gorman
 
PDF
AWR and ASH in an EM12c World
Kellyn Pot'Vin-Gorman
 
PPTX
Practical ASH
David Kurtz
 
PPTX
AWR DB performance Data Mining - Collaborate 2015
Yury Velikanov
 
PDF
Calculating SQL Runtime Using Raw ASH Data.pdf
Yuan Yao
 
PDF
OTN tour 2015 AWR data mining
Andrejs Vorobjovs
 
PPT
active_session_history_oracle_performance.ppt
cookie1969
 
PPT
AWR, ADDM, ASH, Metrics and Advisors.ppt
bugzbinny
 
PPTX
Advanced Database Administration 10g
Connor McDonald
 
PPTX
Monitor database essentials with Applications Manager
ManageEngine, Zoho Corporation
 
PPTX
IOUG Collaborate 2014 ASH/AWR Deep Dive
Kellyn Pot'Vin-Gorman
 
PPTX
Oracle performance tuning_sfsf
Mao Geng
 
PDF
Beyond SQL Tuning: Insider's Guide to Maximizing SQL Performance
Ashish Agrawal
 
Barun_Practical_and_Efficient_SQL_Performance_Tuning
Vlado Barun
 
Ash and awr deep dive hotsos
Kellyn Pot'Vin-Gorman
 
ASH and AWR on DB12c
Kellyn Pot'Vin-Gorman
 
Donatone_Grid Performance(2)11111111.pdg
cookie1969
 
Oracle Database Performance Tuning Basics
nitin anjankar
 
Further Adventures With ASH
David Kurtz
 
Kellyn Pot'Vin-Gorman - Awr and Ash
gaougorg
 
Sherlock holmes for dba’s
Kellyn Pot'Vin-Gorman
 
AWR and ASH in an EM12c World
Kellyn Pot'Vin-Gorman
 
Practical ASH
David Kurtz
 
AWR DB performance Data Mining - Collaborate 2015
Yury Velikanov
 
Calculating SQL Runtime Using Raw ASH Data.pdf
Yuan Yao
 
OTN tour 2015 AWR data mining
Andrejs Vorobjovs
 
active_session_history_oracle_performance.ppt
cookie1969
 
AWR, ADDM, ASH, Metrics and Advisors.ppt
bugzbinny
 
Advanced Database Administration 10g
Connor McDonald
 
Monitor database essentials with Applications Manager
ManageEngine, Zoho Corporation
 
IOUG Collaborate 2014 ASH/AWR Deep Dive
Kellyn Pot'Vin-Gorman
 
Oracle performance tuning_sfsf
Mao Geng
 
Beyond SQL Tuning: Insider's Guide to Maximizing SQL Performance
Ashish Agrawal
 
Ad

Recently uploaded (20)

PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
July Patch Tuesday
Ivanti
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 

Performance Tuning With Oracle ASH and AWR. Part 1 How And What

  • 1. Part 1 : What, When and How Virtathon 7/2011 Uday Moogala Vlado Barun
  • 2. Uday Moogala Sr. Principal Engineer with Oracle Apps Development 15 years in the Oracle Database arena Vlado Barun, M.Sc. Sr. Principal Performance Engineer with Oracle Cloud Services OCP, OCE SQL, MCP 15 years in the Database Arena (Oracle - 10 years) Who we are
  • 3. All the views expressed in this presentation are the opinion of the authors and do not necessarily reflect the views of Oracle America, Inc. The queries are provided "as is", without warranty of any kind, expressed or implied. Disclaimer
  • 4. How to approach a SQL performance issue What diagnostic data to gather Generating and interpreting AWR Report ASH Reports SQL Execution Plans Real-Time SQL Monitoring Reports Agenda
  • 5. In order to know what to fix, we need to be able to see what’s broken! - Dan Roam
  • 6. What Identify (app is slow) Quantify (takes 1m) Timeline (in peak hours) Component (MT or DB or N/W) Flow chart Root Cause (Stats not updated) AWR/ASH, Trace, Apps Logs/Tables, OS/IO stats etc SQL/Object Stats, Execution Plans, etc Initial Data collec-tion How Much When Where How Why Analyze Additional Data collec-tion Understanding the issue…
  • 7. Non-DB Time DB Time Getting to know the System…
  • 8. An example… I/O On CPU I/O On CPU Browse Books Read Reviews For One Book Add to Cart Checkout TIME = time spent in database = user/network/app tier time
  • 9. = time spent in database SQL Trace (Microsecond level) Application Logging (custom level) Gathering Performance Data… (SQL Trace, ASH) 21 ASH Samples 3 ASH Samples in AWR Browse Books Read Reviews For One Book Add to Cart Checkout TIME v$active_session_history (1 second intervals) dba_hist_active_sess_history (10 second intervals)
  • 10. Automatic Workload Repository (AWR) Collects database performance statistics - Objects (access and usage statistics) SQL Statement statistics Wait events statistics System statistics ASH Statistics ( DBA_HIST_ACTIVE_SESS_HISTORY ) Time Model Statistics based on time usage for activities Every 1 hr by default Stored in DBA_HIST% views How to access? $ORACLE_HOME/rdbms/admin/awrrpt.sql OEM Other tools Sample output
  • 11. Active Session History (ASH) Samples the current state of all active sessions - 1 second samples - Stores various attributes (dimensions) of a session Stored in V$ACTIVE_SESSION_HISTORY 1-second sampling rate DBA_HIST_ACTIVE_SESS_HISTORY Sub-sampling to disk into AWR Snapshot 1-in-10 samples How to access? $ORACLE_HOME/rdbms/admin/ashrpt.sql, ashrpti.sql OEM Other tools Sample output
  • 12. Active Session History (ASH) - Dimensions When SAMPLE_ID SAMPLE_TIME Session SESSION_ID SESSION_SERIAL# SESSION_TYPE SESSION_STATE USER_ID QC_INSTANCE_ID QC_SESSION_ID QC_SESSION_SERIAL# CLIENT_ID IN and IS columns SQL SQL_ID IS_SQLID_CURRENT SQL_CHILD_NUMBER SQL_OPCODE SQL_OPNAME TOP_LEVEL_SQL_ID TOP_LEVEL_SQL_OPCODE SQL_EXEC_ID SQL_EXEC_START SQL_PLAN_HASH_VALUE SQL_PLAN_OPTIONS Row Source SQL_PLAN_LINE_ID SQL_PLAN_OPERATION Waits EVENT EVENT_ID EVENT# SEQ# P1TEXT P1 P2TEXT P2 P3TEXT P3 WAIT_CLASS WAIT_CLASS_ID WAIT_TIME TIME_WAITED CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# CURRENT_ROW# Blocking Session BLOCKING_SESSION_STATUS BLOCKING_SESSION BLOCKING_SESSION_SERIAL# BLOCKING_INST_ID BLOCKING_HANGCHAIN_INFO Object CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# CURRENT_ROW# Application SERVICE_HASH PROGRAM MODULE ACTION MACHINE Statistics TM_DELTA_TIME TM_DELTA_CPU_TIME TM_DELTA_DB_TIME DELTA_TIME DELTA_READ_IO_REQUESTS DELTA_WRITE_IO_REQUESTS DELTA_READ_IO_BYTES DELTA_WRITE_IO_BYTES DELTA_INTERCONNECT_IO_BYTES PGA_ALLOCATED TEMP_SPACE_ALLOCATED
  • 13. SQL Execution Plans DBMS_XPLAIN. DISPLAY_CURSOR Plan is from memory Predicates and outline data most useful when ‘statistics_level’ set to ALL or with gather_plan_statistics hint Sample output DBMS_XPLAIN. DISPLAY_AWR Plan is from AWR (DBA_HIST% views) Runtime (actual) stats are not displayed Sample output Sample output
  • 14. select * from table(dbms_xplan.display_cursor('&SQL_ID',null,'ALLSTATS LAST')); SQL_ID 0s5pdsggxtc54, child number 0 ------------------------------------- Plan hash value: 2832870632 ---------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | 152K(100)| | | 1 | SORT AGGREGATE | | 1 | 2 | | | |* 2 | TABLE ACCESS FULL| TAB_A | 21M| 41M| 152K (5)| 00:00:03 | ---------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("COSTED_FLAG" IS NULL) Note ----- - Warning: basic plan statistics not available. These are only collected when: * hint 'gather_plan_statistics' is used for the statement or * parameter 'statistics_level' is set to 'ALL', at session or system level Display_Cursor Estimates with Statistics_level = Typical SQL_ID 0s5pdsggxtc54, child number 1 ------------------------------------- Plan hash value: 2832870632 -------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | -------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | 1 |00:00:01.73 | 435K| | 1 | SORT AGGREGATE | | 1 | 1 | 1 |00:00:01.73 | 435K| |* 2 | TABLE ACCESS FULL| TAB_A | 1 | 1351K| 2001K|00:00:01.64 | 435K| -------------------------------------------------------------------------------------- Actual runtime stats with Statistics_level = ALL or with gather_plan_statistics hint
  • 15. Display_AWR SQL_ID 0s5pdsggxtc54 -------------------- ---------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | | | 22217 (100)| | | 1 | SORT AGGREGATE | | 1 | 2 | | | | 2 | TABLE ACCESS FULL| TAB_A | 1351K| 2639K| 22217 (1)| 00:04:27 | ----------------------------------------------------------------------------
  • 16. Real-Time SQL Monitoring Monitors SQLs while they are running Automatically monitors parallel SQLs and SQLs taking more than 5 CPU seconds Plan is from memory Predicates CPU and Elapsed Time No. of reads and writes Waits Stored in V$SQL_MONITOR and V$SQL_PLAN_MONITOR views How to access? DBMS_SQLTUNE.REPORT_SQL_MONITOR Enterprise Manager Sample output
  • 17. Summary AWR Report Identified SQL issue Get report snapshots as close as possible to the issue ASH Report - At system level to identify the session At session level to identify the SQL At SQL level to identify the row source, object, and wait events Analyze samples taken during problematic SQL execution SQL Execution Plans Dbms_Xplain.Display_Cursor Dbms_Xplain.Display_AWR set STATISTICS_LEVEL to ‘ ALL ’ or put GATHER_PLAN_STATISTICS hint Real-Time SQL Monitoring Report To monitor the long running or parallel SQL Take several reports and analyze the issue
  • 18. SQL Tuning Trace files SQLT output (MOS Doc: 215187.1) Trace Analyzer (MOS Doc : 224270.1) AWR Report (MOS Doc : 748642.1) AWR SQL Report (awrsqrpt.sql) 11g Real-Time SQL Monitoring SQL Tuning Advisor PL/SQL Tuning Product logs PL/SQL Profiler (MOS Doc : 808005.1) Forms Tuning Forms Tracing (MOS Doc : 373548.1) Generic MOS Doc : 438652.1 Reports Tracing MOS Doc: 111311.1 Database Tuning AWR Report (MOS Doc : 748642.1) ADDM report (MOS Doc : 250655.1) Active Session History (ASH) Report LTOM output (MOS Doc : 352363.1) Middletier Tuning JVM Logs Third Party Tools OS OSWatcher (MOS Doc : 301137.1) Reference
  • 19. Reference Performance Fundamentals for Oracle Database 10g and 11g by Graham Wood and John Beresniewicz (http://www.oracle.com/technetwork/database/focus-areas/manageability/db-perf-tuning-ow08-131582.pdf ) ASH - Active Session History (https://sites.google.com/site/embtdbo/wait-event-documentation/ash---active-session-history)
  • 20. Q & A

Editor's Notes

  • #7: Who: one or all users/programs What: Response Time, Throughput, Error, Crash etc How Much: How Slow When: At what times? Where: Which component? How: Series of events Why: seeing big picture
  • #11: Collects database performance statistics stored in memory and in database used by ADDM and Advisors (SQL Tuning, Segment, Undo) Select * from dict where table_name like ‘DBA_HIST%SQL%’; TABLE_NAME COMMENTS ------------------------------ -------------------------------------------------------------------------------- DBA_HIST_COLORED_SQL Marked SQLs for snapshots DBA_HIST_SQLBIND SQL Bind Information DBA_HIST_SQLCOMMAND_NAME Sql command types DBA_HIST_SQLSTAT SQL Historical Statistics Information DBA_HIST_SQLTEXT SQL Text DBA_HIST_SQL_BIND_METADATA SQL Bind Metadata Information DBA_HIST_SQL_PLAN SQL Plan Information DBA_HIST_SQL_SUMMARY Summary of SQL Statistics DBA_HIST_SQL_WORKAREA_HSTGRM SQL Workarea Histogram History select distinct stat_name from V$SYS_TIME_MODEL ; STAT_NAME ---------------------------------------------------------------- DB CPU background elapsed time hard parse elapsed time RMAN cpu time (backup/restore) DB time hard parse (bind mismatch) elapsed time inbound PL/SQL rpc elapsed time repeated bind elapsed time background cpu time connection management call elapsed time failed parse elapsed time hard parse (sharing criteria) elapsed time PL/SQL compilation elapsed time failed parse (out of shared memory) elapsed time Java execution elapsed time parse time elapsed sequence load elapsed time sql execute elapsed time PL/SQL execution elapsed time 19 rows selected.
  • #13: 11g has SQL_PLAN_LINE_ID, SQL_PLAN_OPERATION to further drilldown a SQL performance issue using ASH