SlideShare a Scribd company logo
1 of 42
1
2
Practical Active Session History (ASH)
John Beresniewicz
Technical Staff, Oracle America
3
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.
4
Background and Credits
• Enterprise Manager and Average Active Sessions
• Graham Wood
• Kyle Hailey
• David Kurtz
• Doug Burns
5
<Insert Picture Here>
Agenda
• Understand ASH
• Use ASH
6
<Insert Picture Here>
Understand ASH
7
Topics
• Mechanics
– ASH design is elegant, efficient, effective
• Meaning
– ASH is the key to multi-scope DB Time analysis
– ASH as activity trace
– ASH outliers
8
ASH Mechanics
Circular buffer
in SGA
(2MB per CPU)
Session
state
objects
V$SESSION
V$SESSION_WAIT
MMON Lite
(MMNL)
V$ACTIVE_SESSION_HISTORY DBA_HIST_ACTIVE_SESS_HISTORY
AWR
Direct-path
INSERTS
Every hour
Write
1 out of 10
samples
Every second
Variable
length rows
(or flush)
Indexe
d
on time
Readers go
unlatched
Writer goes
one direction
Readers go the
opposite way
9
ASH In-memory
• “Active” sessions sampled every 1 second
– Direct session state access and callbacks
– Active = on CPU or in non-idle Wait
– Sampler not visible in ASH
• Circular memory buffer
– Fixed footprint => variable time range
– Design goals: one hour activity and <5% of memory
• Non-latching queries
– Readers/writer go in opposite directions
• Wait times are “fixed up”
– But don’t be tempted to use them incorrectly!
10
ASH Buffer Size and “Length”
select bytes/(1024*1024) MB from v$sgastat where name like 'ASH buffers';
MB
----------------------
29
select
EXTRACT(HOUR FROM (MAX(sample_time) - MIN(sample_time)))||' hours
'||
EXTRACT(MINUTE FROM (MAX(sample_time) - MIN(sample_time)))||'
mins'
ASH_window
from
v$active_session_history;
ASH_WINDOW
-----------------------------------------------------------
12 hours 59 mins
11
ASH On-disk
• 1-in-10 samples persisted with AWR snapshots
• DBA_HIST_ACTIVE_SESS_HISTORY
– Partitioned by DBID, SNAP_ID
– Emergency flush under buffer pressure
• AWR retention 7 days by default
– At least 35 days recommended
• Query snapshot ranges from DBA_HIST_SNAPSHOT
– For partition elimination, not always needed
12
Meaning: ASH is DB Time
• Each sample represents a second of session activity
• Sum the seconds to compute DB Time
– What I like to call ASH MATH
• Average Active Sessions = DB Time/Elapsed Time
– Both load metric and performance indicator
13
ASH as Activity Trace
• ASH covers much of SQL trace usage
– Except where every call and cpu tick must be counted
– Very good for long operations – SQL Monitoring
• Accuracy improves when things get “stuck”
– Longer waits means higher sampling probability
• Enqueue chain dynamics
– Cannot do with SQL trace
– Inactive holders problem
– Should blockers be active?
14
<Insert Picture Here>
Using ASH
15
ASH Use Cases
• DB Time performance analysis
– Aggregation and analytic functions
• Activity tracking
– Real-time SQL Monitoring
• Performance event forensics
– What happened? In what sequence?
– Contention analysis, e.g. enqueue blockages
• Event prediction
– In general too hard
– Outliers may be useful for some event types
16
Using ASH Simplified
17
Top Activity Performance Analysis
• DB Time sourced from ASH
– Real-time only, history uses time model data (bug)
• Average Active Sessions by waitclass
– 15-second bucketing
• 5-minute time selector
– Focus on events of interest
• Top lists for skew analysis and drill-down
• Access to tools
– ASH report, SQL Tune, STS
18
DB Time Performance Analysis
• ASH Math: COUNT(*) = DB Time (seconds)
– GROUP BY dimensions of interest
– Multiply by 10 for on-disk queries
• SUM(1) and SUM(10) nicer
– Reference: David Kurtz
• Do not use MIN, AVG, MAX
– Sampling is biased to longer events
19
ASH Dimensions
desc v$active_session_history
Name Null Type
------------------------------ -------- -----------------------
--------
SAMPLE_ID NUMBER
SAMPLE_TIME TIMESTAMP(3)
IS_AWR_SAMPLE VARCHAR2(1)
SESSION_ID NUMBER
SESSION_SERIAL# NUMBER
SESSION_TYPE VARCHAR2(10)
FLAGS NUMBER
USER_ID NUMBER
.
.
.
93 rows selected
20
SQL Dimensions
SQL Analysis
-------------------------
SQL_ID VARCHAR2(13)
IS_SQLID_CURRENT VARCHAR2(1)
SQL_CHILD_NUMBER NUMBER
SQL_OPCODE NUMBER
SQL_OPNAME VARCHAR2(64)
FORCE_MATCHING_SIGNATURE NUMBER
TOP_LEVEL_SQL_ID VARCHAR2(13)
TOP_LEVEL_SQL_OPCODE NUMBER
SQL_PLAN_HASH_VALUE NUMBER
SQL_PLAN_LINE_ID NUMBER
SQL_PLAN_OPERATION VARCHAR2(30)
SQL_PLAN_OPTIONS VARCHAR2(30)
SQL_EXEC_ID NUMBER
SQL_EXEC_START DATE
PLSQL_ENTRY_OBJECT_ID NUMBER
PLSQL_ENTRY_SUBPROGRAM_ID NUMBER
PLSQL_OBJECT_ID NUMBER
PLSQL_SUBPROGRAM_ID NUMBER
QC_INSTANCE_ID NUMBER
QC_SESSION_ID NUMBER
QC_SESSION_SERIAL# NUMBER
21
Wait Event Dimensions
Wait Event Analysis
--------------------------------------------------
EVENT VARCHAR2(64)
EVENT_ID NUMBER
EVENT# NUMBER
SEQ# NUMBER
P1TEXT VARCHAR2(64)
P1 NUMBER
P2TEXT VARCHAR2(64)
P2 NUMBER
P3TEXT VARCHAR2(64)
P3 NUMBER
WAIT_CLASS VARCHAR2(64)
WAIT_CLASS_ID NUMBER
WAIT_TIME NUMBER
SESSION_STATE VARCHAR2(7)
TIME_WAITED NUMBER
22
Blocking and Object Dimensions
Locking/Blocking Analysis
--------------------------------------------------
BLOCKING_SESSION_STATUS VARCHAR2(11)
BLOCKING_SESSION NUMBER
BLOCKING_SESSION_SERIAL# NUMBER
BLOCKING_INST_ID NUMBER
BLOCKING_HANGCHAIN_INFO VARCHAR2(1)
Object Analysis
--------------------------------------------------
CURRENT_OBJ# NUMBER
CURRENT_FILE# NUMBER
CURRENT_BLOCK# NUMBER
CURRENT_ROW# NUMBER
TOP_LEVEL_CALL# NUMBER
TOP_LEVEL_CALL_NAME VARCHAR2(64)
CONSUMER_GROUP_ID NUMBER
XID RAW(8)
REMOTE_INSTANCE# NUMBER
TIME_MODEL NUMBER
23
Bit Vector Dimensions
Bitvec and Replay
---------------------------------------------------
IN_CONNECTION_MGMT VARCHAR2(1)
IN_PARSE VARCHAR2(1)
IN_HARD_PARSE VARCHAR2(1)
IN_SQL_EXECUTION VARCHAR2(1)
IN_PLSQL_EXECUTION VARCHAR2(1)
IN_PLSQL_RPC VARCHAR2(1)
IN_PLSQL_COMPILATION VARCHAR2(1)
IN_JAVA_EXECUTION VARCHAR2(1)
IN_BIND VARCHAR2(1)
IN_CURSOR_CLOSE VARCHAR2(1)
IN_SEQUENCE_LOAD VARCHAR2(1)
CAPTURE_OVERHEAD VARCHAR2(1)
REPLAY_OVERHEAD VARCHAR2(1)
IS_CAPTURED VARCHAR2(1)
IS_REPLAYED VARCHAR2(1)
24
Application Dimensions
Application Dimensions
------------------------------------------------
SERVICE_HASH NUMBER
PROGRAM VARCHAR2(48)
MODULE VARCHAR2(48)
ACTION VARCHAR2(32)
CLIENT_ID VARCHAR2(64)
MACHINE VARCHAR2(64)
PORT NUMBER
ECID VARCHAR2(64
25
Session Statistics
Session Statistics
---------------------------------------------------
TM_DELTA_TIME NUMBER
TM_DELTA_CPU_TIME NUMBER
TM_DELTA_DB_TIME NUMBER
DELTA_TIME NUMBER
DELTA_READ_IO_REQUESTS NUMBER
DELTA_WRITE_IO_REQUESTS NUMBER
DELTA_READ_IO_BYTES NUMBER
DELTA_WRITE_IO_BYTES NUMBER
DELTA_INTERCONNECT_IO_BYTES NUMBER
PGA_ALLOCATED NUMBER
TEMP_SPACE_ALLOCATED NUMBER
26
Top SQL Over Last 5 Minutes
select NVL(sql_id,'NULL') as sql_id
,count(*) as DB_time
,ROUND(100*count(*) /
SUM(count(*)) OVER (), 2) as Pct_load
from
v$active_session_history
where
sample_time > sysdate - 5/24/60
and session_type <> 'BACKGROUND'
group by sql_id
order by count(*) desc
/
27
Top SQL Over Last 5 Minutes
SQL_ID DB_TIME PCT_LOAD
------------- ---------------------- ----------------------
88v077cs94gak 136 43.17
4xvts5kvsf1w8 89 28.25
8pcw7z5vvhfj0 7 2.22
dbm33sd7kv9s3 5 1.59
572fbaj0fdw2b 5 1.59
6gm349ccd40ty 5 1.59
daq0x8y99dz8f 4 1.27
adfpkwrb7pn7f 4 1.27
d7fgysa7gr9nr 4 1.27
3ugqynb1w2q5a 3 0.95
NULL 3 0.95
28
Events With NULL SQL_ID
select NVL(event,'NULL') as event
,count(*) as samples
,ROUND(count(*)/600,4) as AvgActiveSess
from v$active_session_history
where sql_id IS NULL
and sample_time > sysdate - 10/24/60
and session_type <> 'BACKGROUND'
group by event;
29
Events With NULL SQL_ID
EVENT SAMPLES AVGACTIVESESS
-------------------------------- ---------------------- ----------------------
NULL 6 0.01
cursor: pin S wait on X 1 0.0017
log file sync 1 0.0017
db file sequential read 1 0.0017
IPC send completion sync 1 0.0017
library cache lock 1 0.0017
direct path read 1 0.0017
7 rows selected
30
User I/O DB Time by Instance
select inst_id as instance
,event
,COUNT(distinct current_obj#) as objcount
,SUM(1) as dbtime_secs
from gv$active_session_history
where sample_time > sysdate - 1/24/60 -- pick up last minute only
and wait_class = 'User I/O'
group by inst_id,event
order by event,instance;
select * from table(dbms_xplan.display_cursor());
31
Not Much I/O
INSTANCE EVENT OBJCOUNT DBTIME_SECS
---------- ------------------------ ----------- -----------
1 db file sequential read 4 5
2 db file sequential read 3 3
3 db file sequential read 1 1
1 direct path read 1 1
2 direct path read 1 1
1 direct path write 1 1
2 direct path write 1 1
7 rows selected
32
XPLAN Output
| Id | Operation | Name |
| 0 | SELECT STATEMENT | |
| 1 | SORT GROUP BY | |
| 2 | VIEW | VW_DAG_0 |
| 3 | HASH GROUP BY | |
|* 4 | PX COORDINATOR | |
| 5 | PX SEND QC (RANDOM) | :TQ10000 |
|* 6 | VIEW | GV$ACTIVE_SESSION_HISTORY |
| 7 | NESTED LOOPS | |
|* 8 | FIXED TABLE FULL | X$KEWASH |
|* 9 | FIXED TABLE FIXED INDEX| X$ASH (ind:1) |
Predicate Information (identified by operation id):
33
Compare Time Model and ASH
alter session set nls_date_format='YYYY:MM:DD:HH24:MI:SS';
select M.end_time
,ROUND(M.value / 100,3) as Metric_AAS
,ROUND(SUM(DECODE(A.session_type,'FOREGROUND',1,0)) /
((M.end_time - M.begin_time) * 86400 ),3)
as ASH_AAS
,COUNT(1) as ASH_count
from
v$active_session_history A
,v$sysmetric_history M
where
A.sample_time between M.begin_time and M.end_time
and M.metric_name = 'Database Time Per Sec' -- 10g metric
and M.group_id = 2
group by M.end_time,M.begin_time, M.value
order by M.end_time
/
34
ASH Report
35
ASH Report
36
Instrument Applications
• Separate major workloads by Service
– Can be externally controlled at connection layer
• Module, Action instrumented apps benefit
• Client_ID
• ECID (end-to-end tracking)
37
ASH Dumps
• Dump ASH samples into text file on disk
• Load into tables or spreadsheet
• May need reference tables
• Capture performance events for forensic analysis
38
Dumping ASH to file
• 10 => minutes of history you want to dump
• File can be loaded into database using loader control
file rdbms/demo/ashldr.ctl
>oradebug setmypid
>oradebug dump ashdump 10
>alter session set events 'immediate trace name ashdump level 10';
39
ASH Dump Treemaps
40
Conclusions
• ASH can answer many questions
– DB Time analysis at many scoping levels
– Session activity over time
– Workload characterization
• Understand the mechanism for best results
– Sampling is not tracing but is often good enough
– ASH estimates DB Time quite accurately
41
42

More Related Content

Similar to active_session_history_oracle_performance.ppt

My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMarkus Flechtner
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuningafa reg
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaaCuneyt Goksu
 
ASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'VinASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'VinEnkitec
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basicsnitin anjankar
 
Analyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptxAnalyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptxssuserbad8d3
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningJugal Shah
 
Awr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reportsAwr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reportsJohn Beresniewicz
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Kyle Hailey
 
Oracle-DB: Performance Analysis with Panorama
Oracle-DB: Performance Analysis with PanoramaOracle-DB: Performance Analysis with Panorama
Oracle-DB: Performance Analysis with PanoramaPeter Ramm
 
Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Eduardo Castro
 
SQL Server Performance Analysis
SQL Server Performance AnalysisSQL Server Performance Analysis
SQL Server Performance AnalysisEduardo Castro
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upAWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upJohn Beresniewicz
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoMauro Pagano
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerAndrejs Vorobjovs
 
Oracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approachOracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approachLaurent Leturgez
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance TuningBala Subra
 

Similar to active_session_history_oracle_performance.ppt (20)

My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please help
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuning
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
 
ASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'VinASH and AWR Performance Data by Kellyn Pot'Vin
ASH and AWR Performance Data by Kellyn Pot'Vin
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
 
Analyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptxAnalyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptx
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Ash and awr performance data2
Ash and awr performance data2Ash and awr performance data2
Ash and awr performance data2
 
Awr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reportsAwr1page - Sanity checking time instrumentation in AWR reports
Awr1page - Sanity checking time instrumentation in AWR reports
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle
 
Oracle-DB: Performance Analysis with Panorama
Oracle-DB: Performance Analysis with PanoramaOracle-DB: Performance Analysis with Panorama
Oracle-DB: Performance Analysis with Panorama
 
Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008Ajuste (tuning) del rendimiento de SQL Server 2008
Ajuste (tuning) del rendimiento de SQL Server 2008
 
SQL Server Performance Analysis
SQL Server Performance AnalysisSQL Server Performance Analysis
SQL Server Performance Analysis
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upAWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add up
 
OOW13 JB KP ASH Deep Dive
OOW13 JB KP ASH Deep DiveOOW13 JB KP ASH Deep Dive
OOW13 JB KP ASH Deep Dive
 
ASH and AWR on DB12c
ASH and AWR on DB12cASH and AWR on DB12c
ASH and AWR on DB12c
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tango
 
DB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource ManagerDB12c: All You Need to Know About the Resource Manager
DB12c: All You Need to Know About the Resource Manager
 
Oracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approachOracle Database : Addressing a performance issue the drilldown approach
Oracle Database : Addressing a performance issue the drilldown approach
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance Tuning
 

More from cookie1969

200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DBcookie1969
 
dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...
dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...
dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...cookie1969
 
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdfHailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdfcookie1969
 
Kyle Hailey Oracle Performance IO Waits
Kyle Hailey  Oracle Performance IO WaitsKyle Hailey  Oracle Performance IO Waits
Kyle Hailey Oracle Performance IO Waitscookie1969
 
Pivot query on Automatic Workload Repository _ OraDBA.pdf
Pivot query on Automatic Workload Repository _ OraDBA.pdfPivot query on Automatic Workload Repository _ OraDBA.pdf
Pivot query on Automatic Workload Repository _ OraDBA.pdfcookie1969
 
ZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdf
ZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdfZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdf
ZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdfcookie1969
 
R07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdfR07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdfcookie1969
 
IO_Analysis_with_SAR.ppt
IO_Analysis_with_SAR.pptIO_Analysis_with_SAR.ppt
IO_Analysis_with_SAR.pptcookie1969
 
02062022_ASH_Bazgutdinov_FORS.pdf
02062022_ASH_Bazgutdinov_FORS.pdf02062022_ASH_Bazgutdinov_FORS.pdf
02062022_ASH_Bazgutdinov_FORS.pdfcookie1969
 
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdfNOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdfcookie1969
 

More from cookie1969 (10)

200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB200603ash.pdf Performance Tuning Oracle DB
200603ash.pdf Performance Tuning Oracle DB
 
dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...
dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...
dokumen.tips_oracle-10g-advanced-performance-tuning-kyle-hailey-kylelfgmailco...
 
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdfHailey_Database_Performance_Made_Easy_through_Graphics.pdf
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
 
Kyle Hailey Oracle Performance IO Waits
Kyle Hailey  Oracle Performance IO WaitsKyle Hailey  Oracle Performance IO Waits
Kyle Hailey Oracle Performance IO Waits
 
Pivot query on Automatic Workload Repository _ OraDBA.pdf
Pivot query on Automatic Workload Repository _ OraDBA.pdfPivot query on Automatic Workload Repository _ OraDBA.pdf
Pivot query on Automatic Workload Repository _ OraDBA.pdf
 
ZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdf
ZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdfZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdf
ZcCsXvjIRFKcqd2Yzt4d_Shallahamer-MLPoorPerf-3d.pdf
 
R07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdfR07_Senegacnik_CBO.pdf
R07_Senegacnik_CBO.pdf
 
IO_Analysis_with_SAR.ppt
IO_Analysis_with_SAR.pptIO_Analysis_with_SAR.ppt
IO_Analysis_with_SAR.ppt
 
02062022_ASH_Bazgutdinov_FORS.pdf
02062022_ASH_Bazgutdinov_FORS.pdf02062022_ASH_Bazgutdinov_FORS.pdf
02062022_ASH_Bazgutdinov_FORS.pdf
 
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdfNOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
NOCOUG_201311_Fine_Tuning_Execution_Plans.pdf
 

Recently uploaded

HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 

Recently uploaded (20)

HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 

active_session_history_oracle_performance.ppt

  • 1. 1
  • 2. 2 Practical Active Session History (ASH) John Beresniewicz Technical Staff, Oracle America
  • 3. 3 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.
  • 4. 4 Background and Credits • Enterprise Manager and Average Active Sessions • Graham Wood • Kyle Hailey • David Kurtz • Doug Burns
  • 5. 5 <Insert Picture Here> Agenda • Understand ASH • Use ASH
  • 7. 7 Topics • Mechanics – ASH design is elegant, efficient, effective • Meaning – ASH is the key to multi-scope DB Time analysis – ASH as activity trace – ASH outliers
  • 8. 8 ASH Mechanics Circular buffer in SGA (2MB per CPU) Session state objects V$SESSION V$SESSION_WAIT MMON Lite (MMNL) V$ACTIVE_SESSION_HISTORY DBA_HIST_ACTIVE_SESS_HISTORY AWR Direct-path INSERTS Every hour Write 1 out of 10 samples Every second Variable length rows (or flush) Indexe d on time Readers go unlatched Writer goes one direction Readers go the opposite way
  • 9. 9 ASH In-memory • “Active” sessions sampled every 1 second – Direct session state access and callbacks – Active = on CPU or in non-idle Wait – Sampler not visible in ASH • Circular memory buffer – Fixed footprint => variable time range – Design goals: one hour activity and <5% of memory • Non-latching queries – Readers/writer go in opposite directions • Wait times are “fixed up” – But don’t be tempted to use them incorrectly!
  • 10. 10 ASH Buffer Size and “Length” select bytes/(1024*1024) MB from v$sgastat where name like 'ASH buffers'; MB ---------------------- 29 select EXTRACT(HOUR FROM (MAX(sample_time) - MIN(sample_time)))||' hours '|| EXTRACT(MINUTE FROM (MAX(sample_time) - MIN(sample_time)))||' mins' ASH_window from v$active_session_history; ASH_WINDOW ----------------------------------------------------------- 12 hours 59 mins
  • 11. 11 ASH On-disk • 1-in-10 samples persisted with AWR snapshots • DBA_HIST_ACTIVE_SESS_HISTORY – Partitioned by DBID, SNAP_ID – Emergency flush under buffer pressure • AWR retention 7 days by default – At least 35 days recommended • Query snapshot ranges from DBA_HIST_SNAPSHOT – For partition elimination, not always needed
  • 12. 12 Meaning: ASH is DB Time • Each sample represents a second of session activity • Sum the seconds to compute DB Time – What I like to call ASH MATH • Average Active Sessions = DB Time/Elapsed Time – Both load metric and performance indicator
  • 13. 13 ASH as Activity Trace • ASH covers much of SQL trace usage – Except where every call and cpu tick must be counted – Very good for long operations – SQL Monitoring • Accuracy improves when things get “stuck” – Longer waits means higher sampling probability • Enqueue chain dynamics – Cannot do with SQL trace – Inactive holders problem – Should blockers be active?
  • 15. 15 ASH Use Cases • DB Time performance analysis – Aggregation and analytic functions • Activity tracking – Real-time SQL Monitoring • Performance event forensics – What happened? In what sequence? – Contention analysis, e.g. enqueue blockages • Event prediction – In general too hard – Outliers may be useful for some event types
  • 17. 17 Top Activity Performance Analysis • DB Time sourced from ASH – Real-time only, history uses time model data (bug) • Average Active Sessions by waitclass – 15-second bucketing • 5-minute time selector – Focus on events of interest • Top lists for skew analysis and drill-down • Access to tools – ASH report, SQL Tune, STS
  • 18. 18 DB Time Performance Analysis • ASH Math: COUNT(*) = DB Time (seconds) – GROUP BY dimensions of interest – Multiply by 10 for on-disk queries • SUM(1) and SUM(10) nicer – Reference: David Kurtz • Do not use MIN, AVG, MAX – Sampling is biased to longer events
  • 19. 19 ASH Dimensions desc v$active_session_history Name Null Type ------------------------------ -------- ----------------------- -------- SAMPLE_ID NUMBER SAMPLE_TIME TIMESTAMP(3) IS_AWR_SAMPLE VARCHAR2(1) SESSION_ID NUMBER SESSION_SERIAL# NUMBER SESSION_TYPE VARCHAR2(10) FLAGS NUMBER USER_ID NUMBER . . . 93 rows selected
  • 20. 20 SQL Dimensions SQL Analysis ------------------------- SQL_ID VARCHAR2(13) IS_SQLID_CURRENT VARCHAR2(1) SQL_CHILD_NUMBER NUMBER SQL_OPCODE NUMBER SQL_OPNAME VARCHAR2(64) FORCE_MATCHING_SIGNATURE NUMBER TOP_LEVEL_SQL_ID VARCHAR2(13) TOP_LEVEL_SQL_OPCODE NUMBER SQL_PLAN_HASH_VALUE NUMBER SQL_PLAN_LINE_ID NUMBER SQL_PLAN_OPERATION VARCHAR2(30) SQL_PLAN_OPTIONS VARCHAR2(30) SQL_EXEC_ID NUMBER SQL_EXEC_START DATE PLSQL_ENTRY_OBJECT_ID NUMBER PLSQL_ENTRY_SUBPROGRAM_ID NUMBER PLSQL_OBJECT_ID NUMBER PLSQL_SUBPROGRAM_ID NUMBER QC_INSTANCE_ID NUMBER QC_SESSION_ID NUMBER QC_SESSION_SERIAL# NUMBER
  • 21. 21 Wait Event Dimensions Wait Event Analysis -------------------------------------------------- EVENT VARCHAR2(64) EVENT_ID NUMBER EVENT# NUMBER SEQ# NUMBER P1TEXT VARCHAR2(64) P1 NUMBER P2TEXT VARCHAR2(64) P2 NUMBER P3TEXT VARCHAR2(64) P3 NUMBER WAIT_CLASS VARCHAR2(64) WAIT_CLASS_ID NUMBER WAIT_TIME NUMBER SESSION_STATE VARCHAR2(7) TIME_WAITED NUMBER
  • 22. 22 Blocking and Object Dimensions Locking/Blocking Analysis -------------------------------------------------- BLOCKING_SESSION_STATUS VARCHAR2(11) BLOCKING_SESSION NUMBER BLOCKING_SESSION_SERIAL# NUMBER BLOCKING_INST_ID NUMBER BLOCKING_HANGCHAIN_INFO VARCHAR2(1) Object Analysis -------------------------------------------------- CURRENT_OBJ# NUMBER CURRENT_FILE# NUMBER CURRENT_BLOCK# NUMBER CURRENT_ROW# NUMBER TOP_LEVEL_CALL# NUMBER TOP_LEVEL_CALL_NAME VARCHAR2(64) CONSUMER_GROUP_ID NUMBER XID RAW(8) REMOTE_INSTANCE# NUMBER TIME_MODEL NUMBER
  • 23. 23 Bit Vector Dimensions Bitvec and Replay --------------------------------------------------- IN_CONNECTION_MGMT VARCHAR2(1) IN_PARSE VARCHAR2(1) IN_HARD_PARSE VARCHAR2(1) IN_SQL_EXECUTION VARCHAR2(1) IN_PLSQL_EXECUTION VARCHAR2(1) IN_PLSQL_RPC VARCHAR2(1) IN_PLSQL_COMPILATION VARCHAR2(1) IN_JAVA_EXECUTION VARCHAR2(1) IN_BIND VARCHAR2(1) IN_CURSOR_CLOSE VARCHAR2(1) IN_SEQUENCE_LOAD VARCHAR2(1) CAPTURE_OVERHEAD VARCHAR2(1) REPLAY_OVERHEAD VARCHAR2(1) IS_CAPTURED VARCHAR2(1) IS_REPLAYED VARCHAR2(1)
  • 24. 24 Application Dimensions Application Dimensions ------------------------------------------------ SERVICE_HASH NUMBER PROGRAM VARCHAR2(48) MODULE VARCHAR2(48) ACTION VARCHAR2(32) CLIENT_ID VARCHAR2(64) MACHINE VARCHAR2(64) PORT NUMBER ECID VARCHAR2(64
  • 25. 25 Session Statistics Session Statistics --------------------------------------------------- TM_DELTA_TIME NUMBER TM_DELTA_CPU_TIME NUMBER TM_DELTA_DB_TIME NUMBER DELTA_TIME NUMBER DELTA_READ_IO_REQUESTS NUMBER DELTA_WRITE_IO_REQUESTS NUMBER DELTA_READ_IO_BYTES NUMBER DELTA_WRITE_IO_BYTES NUMBER DELTA_INTERCONNECT_IO_BYTES NUMBER PGA_ALLOCATED NUMBER TEMP_SPACE_ALLOCATED NUMBER
  • 26. 26 Top SQL Over Last 5 Minutes select NVL(sql_id,'NULL') as sql_id ,count(*) as DB_time ,ROUND(100*count(*) / SUM(count(*)) OVER (), 2) as Pct_load from v$active_session_history where sample_time > sysdate - 5/24/60 and session_type <> 'BACKGROUND' group by sql_id order by count(*) desc /
  • 27. 27 Top SQL Over Last 5 Minutes SQL_ID DB_TIME PCT_LOAD ------------- ---------------------- ---------------------- 88v077cs94gak 136 43.17 4xvts5kvsf1w8 89 28.25 8pcw7z5vvhfj0 7 2.22 dbm33sd7kv9s3 5 1.59 572fbaj0fdw2b 5 1.59 6gm349ccd40ty 5 1.59 daq0x8y99dz8f 4 1.27 adfpkwrb7pn7f 4 1.27 d7fgysa7gr9nr 4 1.27 3ugqynb1w2q5a 3 0.95 NULL 3 0.95
  • 28. 28 Events With NULL SQL_ID select NVL(event,'NULL') as event ,count(*) as samples ,ROUND(count(*)/600,4) as AvgActiveSess from v$active_session_history where sql_id IS NULL and sample_time > sysdate - 10/24/60 and session_type <> 'BACKGROUND' group by event;
  • 29. 29 Events With NULL SQL_ID EVENT SAMPLES AVGACTIVESESS -------------------------------- ---------------------- ---------------------- NULL 6 0.01 cursor: pin S wait on X 1 0.0017 log file sync 1 0.0017 db file sequential read 1 0.0017 IPC send completion sync 1 0.0017 library cache lock 1 0.0017 direct path read 1 0.0017 7 rows selected
  • 30. 30 User I/O DB Time by Instance select inst_id as instance ,event ,COUNT(distinct current_obj#) as objcount ,SUM(1) as dbtime_secs from gv$active_session_history where sample_time > sysdate - 1/24/60 -- pick up last minute only and wait_class = 'User I/O' group by inst_id,event order by event,instance; select * from table(dbms_xplan.display_cursor());
  • 31. 31 Not Much I/O INSTANCE EVENT OBJCOUNT DBTIME_SECS ---------- ------------------------ ----------- ----------- 1 db file sequential read 4 5 2 db file sequential read 3 3 3 db file sequential read 1 1 1 direct path read 1 1 2 direct path read 1 1 1 direct path write 1 1 2 direct path write 1 1 7 rows selected
  • 32. 32 XPLAN Output | Id | Operation | Name | | 0 | SELECT STATEMENT | | | 1 | SORT GROUP BY | | | 2 | VIEW | VW_DAG_0 | | 3 | HASH GROUP BY | | |* 4 | PX COORDINATOR | | | 5 | PX SEND QC (RANDOM) | :TQ10000 | |* 6 | VIEW | GV$ACTIVE_SESSION_HISTORY | | 7 | NESTED LOOPS | | |* 8 | FIXED TABLE FULL | X$KEWASH | |* 9 | FIXED TABLE FIXED INDEX| X$ASH (ind:1) | Predicate Information (identified by operation id):
  • 33. 33 Compare Time Model and ASH alter session set nls_date_format='YYYY:MM:DD:HH24:MI:SS'; select M.end_time ,ROUND(M.value / 100,3) as Metric_AAS ,ROUND(SUM(DECODE(A.session_type,'FOREGROUND',1,0)) / ((M.end_time - M.begin_time) * 86400 ),3) as ASH_AAS ,COUNT(1) as ASH_count from v$active_session_history A ,v$sysmetric_history M where A.sample_time between M.begin_time and M.end_time and M.metric_name = 'Database Time Per Sec' -- 10g metric and M.group_id = 2 group by M.end_time,M.begin_time, M.value order by M.end_time /
  • 36. 36 Instrument Applications • Separate major workloads by Service – Can be externally controlled at connection layer • Module, Action instrumented apps benefit • Client_ID • ECID (end-to-end tracking)
  • 37. 37 ASH Dumps • Dump ASH samples into text file on disk • Load into tables or spreadsheet • May need reference tables • Capture performance events for forensic analysis
  • 38. 38 Dumping ASH to file • 10 => minutes of history you want to dump • File can be loaded into database using loader control file rdbms/demo/ashldr.ctl >oradebug setmypid >oradebug dump ashdump 10 >alter session set events 'immediate trace name ashdump level 10';
  • 40. 40 Conclusions • ASH can answer many questions – DB Time analysis at many scoping levels – Session activity over time – Workload characterization • Understand the mechanism for best results – Sampling is not tracing but is often good enough – ASH estimates DB Time quite accurately
  • 41. 41
  • 42. 42