SlideShare ist ein Scribd-Unternehmen logo
1 von 154
Downloaden Sie, um offline zu lesen
ASH Masters 
ASH SQL Query Repository 
Kyle Hailey 
kylehailey.com 
Kyle@delphix.com 
slideshare.net/khailey 
10/04/14 1
How do you tune a Database? 
Database is running slow! 
• first step? 
• questions? 
• tools? 
• repeatable method?
What statistics do you look 
at? 
Disastrously difficult
Imagine Trying to Drive your 
Car 
WWoouulldd yyoouu wwaanntt yyoouurr ddaasshhbbooaarrdd ttoo llooookk lliikkee :: 
AAnndd iiss uuppddaatteedd oonnccee aanndd hhoouurr 
OOrr wwoouulldd yyoouu lliikkee iitt ttoo 
llooookk ……
How Can We Open the Black Box? ASH 
Max CPU 
(yard stick) 
TToopp AAccttiivviittyy 
SSQQLL 
SSeessssiioonnss 
LLOOAADD 
Don’t always have OEM, but always have SQL
Ideas for Today 
OOEEMM 
AASSHH 
SSaammpplliinngg 
WWaaiittss 
Where does the OEM data come from ?
Ideas for Today 
OOEEMM 
AASSHH 
SSaammpplliinngg 
WWaaiittss
SSttaattssppaacckk:: CChheeaatt SShheeeett 
• Install 
– Connect as SYSDBA 
–@?/rdbms/admin/spcreate.sql 
• Run 
– Exec statspack.snap; 
• Generate Reports 
–@?/rdbms/admin/spreport.sql 
– (AWR : @?/rdbms/admin/awrrpt.sql ) 
Statspack = always available 
Copyright 2006 Kyle Hailey
SSttaattssppaacckk SSeeccttiioonnss ((100gg)) 
Instance description 
Host hardware 
Snapshot headline 
Cache information 
Load profile 
Instance efficiency 
Shared pool stats 
Top timed events 
Host CPU load 
Host / Instance CPU warning 
VM activity 
Memory usage 
Time model stats 
RAC statistics 
All wait events 
Background wait events 
Event histogram 
SQL x 9 
Instance activity 
Log switches 
OS stats 
Latch parent and child 
Mutex 
Segment stats x 8 
Dictionary cache 
Library cache 
RAC (GES) 
RAC (CR and CUR 
served) 
RAC (cache xfer x 2) 
RAC (Remastering) 
Streams x 7 
Shared pool advisor 
Java pool advisor 
SGA resizing 
SGA target advisor 
SGA summary 
SGA detail 
SQL memory summary 
Resource limits 
Parameters 
Session details x 3 
Tablespace I/O 
File I/O 
File I/O histogram 
Buffer pool 
Instance Recovery 
Buffer pool advisory 
Buffer busy waits 
Various PGA 
summaries 
PGA histogram 
PGA advisory 
PGA allocation 
summary 
PGA allocation top 
N 
Enqueue (lock) 
activity 
Undo stats x 2 
Latch activity 
Latch miss details
SSttaattssppaacckk MMeetthhoodd 
Top 5 Timed Events 
~~~~~~~~~~~~~~~~~~ % Total 
Event Waits Time (s) Call Time 
---------------------- ------------ ----------- --------- 
buffer busy waits 2,748 250 78.72 
CPU time 32 10.16 
free buffer waits 1,588 15 4.63 
write complete waits 10 8 2.51 
log buffer space 306 5 1.51 
Load profile good for 
having a feel for the 
application and 
comparing two 
periods for changes 
Efficiency ratios 
misleading carry 
over from version 6 
days 
---------------------------------------- 
Who/When 
Summary 
Waits 
Big Picture
LLaattcchh FFrreeee 
Top 5 Timed Events 
~~~~~~~~~~~~~~~~~~ % Total 
Event Waits Time (s) Ela Time 
-------------------------------------------- ------------ ----------- -------- 
latch free 9,652 760 66.10 
CPU time 248 21.62 
PL/SQL lock timer 41 123 10.72 
SQL*Net message from dblink 681 14 1.22 
log file parallel write 128 1 .13 
------------------------------------------------------------- 
What Latch? There are 100s 
Latch Sleep breakdown for DB: CDB Instance: cdb Snaps: 3 -4 
-> ordered by misses desc 
Latch Name Requests Misses SSlleeeeppss Sleeps 1->4 
-------------------------- -------------- ----------- ----------- ------------ 
ccaacchhee bbuuffffeerrss cchhaaiinnss 88,,444488,,778877 664499,,448844 66,,993300 00//00//00//00//00 
library cache pin 8,405,896 82,915 1,427 81537/1330/4 
7/1/0 
library cache 8,435,488 55,645 1,294 54375/1247/2 
2/1/0 
shared pool 58,626 7 1 6/1/0/0/0
RRooww LLoocckkss 100gg++ 
op 5 Timed Events Avg %Total 
~~~~~~~~~~~~~~~~~~ wait Call 
Event Waits Time (s) (ms) Time 
----------------------------------------- ------------ ----------- ------ ------ 
enq: TX - row lock contention 59 160 2714 41.8 
PL/SQL lock timer 4 117 29291 30.6 
CPU time 28 7.2 
buffer busy waits 1,217 18 15 4.7 
log file parallel write 422 11 27 3.0 
Who is waiting 
Who is blocking 
What is the SQL 
What is the row?
BBuuffffeerr BBuussyy WWaaiitt 
Top 5 Timed Events 
~~~~~~~~~~~~~~~~~~ % Total 
Event Waits Time (s) Call Time 
-------------------------------------------- ------------ ----------- --------- 
buffer busy waits 2,748 250 78.72 
CPU time 32 10.16 
free buffer waits 1,588 15 4.63 
write complete waits 10 8 2.51 
log buffer space 306 5 1.51 
------------------------------------------------------------ 
Buffer Busy Wait – trying to modify a block 
Who blocks? 
What object? 
what is the SQL? 
Statspack fails for analysis
Ideas for Today 
OOEEMM 
AASSHH 
SSaammpplliinngg 
WWaaiittss
Example 
• Look at Statspack: 
TToopp 55 TTiimmeedd EEvveennttss 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %% TToottaall 
EEvveenntt WWaaiittss TTiimmee ((ss)) CCaallll TTiimmee 
------------------------------------------------------ ---------------------- ------------------ 
bbuuffffeerr bbuussyy wwaaiittss 22,,774488 225500 7788..7722 
CCPPUU ttiimmee 3322 1100..1166 
ffrreeee bbuuffffeerr wwaaiittss 11,,558888 1155 44..6633 
wwrriittee ccoommpplleettee wwaaiittss 1100 88 22..5511 
lloogg bbuuffffeerr ssppaaccee 330066 55 11..5511 
--------------------------------------------------------------
What do we do? 
• “buffer busy wait” ??? 
• Need: 
• SQL 
• Sessions 
• Objects 
• How do we get that information? 
– Not from Statspack or AWR 
– But from v$session 
• v$session_wait prior to 10g
V$session 
• Shows who is waiting 
– Ex) “buffer busy waits” 
• Data only exists while waits are happening 
• Data includes 
• Sql 
• Session 
• Object 
• Type of buffer busy wait 
• File and block involved in buffer busy wait 
• Problem: Once waits are over, data is gone 
• Solution: Sample data all the time
Sample Query 
select 
nvl(s.username,s.program) username, 
s.sid sid, 
s.serial# serial, 
s.sql_hash_value sql_hash_value, 
substr(decode(w.wait_time, 
0, w.event, 
'ON CPU'),1,15) event , 
w.p1 p1, 
w.p2 p2, 
w.p3 p3 
from v$session s, 
v$session_wait w 
where w.sid=s.sid 
and s.status='ACTIVE' 
and s.type='USER'; 
SSQQLL iiddeennttiiffiieerr 
WWaaiittiinngg oorr oonn CCPPUU?? 
TThhiiss qquueerryy wwoorrkkss ssiinnccee vv77
Sampling Output 
USERNAME SID SERIAL SQL_HASH_V EVENT P1 P2 P3 
---------- ----- -------- ---------- -------------------- -------- -------- ---- 
SYS 64 8717 4116021597 PL/SQL lock timer 300 0 0 
SYS 58 19467 961168820 ON CPU 16508152 1 0 
STARGUS 71 6251 1311875676 direct path write 201 2155902 127 
(CJQ0) 9 1 0 rdbms ipc message 500 0 0 
Run sample query every second and 
save into a table “v$ash” 
Create table v$ash as select … ; 
Insert into v$ash select … ;
Buffer busy wait type 
Buffer Busy Wait 
P1 = file # 
P2 = block # 
P3 = block type 
SQL> Select count(*), p3 
from v$ash 
where event = 'buffer busy waits' 
group by p3; 
COUNT(*) P3 
---------- ---- 
3423 1 
From v$event_name 
Or documentation
Buffer busy wait type 
Buffer Busy Wait 
P3 = block type 
Block types come from 
select rownum n, 
class 
from v$waitstat; 
N CLASS 
1 data block 
2 sort block 
3 save undo block 
4 segment header 
5 save undo header 
6 free list 
7 extent map 
8 1st level bmb 
9 2nd level bmb 
10 3rd level bmb 
11 bitmap block 
12 bitmap index block 
13 file header block 
14 unused 
15 system undo header 
16 system undo block 
17 undo header 
18 undo block
File and Block #s 
select count(*), p1 filen, p2 blockn 
from v$ash 
where event='buffer busy waits' 
group by p1, p2, hash_value; 
COUNT(*) FILEN BLOCKN 
---------- -------- -------- 
1 11 90644 
2 11 90651 
3 11 98233 
1 11 104767 
3 11 113291 
1 11 119842 
1 11 119856 
3 11 121632 
1 11 126334 
Pick a File and Block to find object
Find Object 
column segment_name format a30 
select 
owner, 
segment_name, 
segment_type, 
block_id, blocks+block_id 
COUNT(*) FILEN BLOCKN 
---------- -------- -------- 
1 11 126334 
from dba_extents 
where file_id = 11 
and 126334 between block_id AND block_id + blocks-1; 
OWNER SEGMENT_NAME SEGMENT_TY BLOCK_ID BLOCKS+BLOCK_ID 
---------- ------------------ ---------- ---------- --------------- 
SYSTEM TOTO1 TABLE 125201 127249
What SQL ? 
SQL> select count(*), sql_hash_value 
2 from v$ash 
3 where event='buffer busy waits' 
4 group by hash_value; 
COUNT(*) SQL_HASH_VALUE 
---------- -------------- 
3423 558666863 
All the same SQL SQL_HASH_VALUE = 558666863 
NOTE: Preferable to use SQL_ID
SQL Statement ? 
select sql_text 
from v$sqltext 
where hash_value=558666863; 
SQL_TEXT 
----------------------------------------------------- 
INSERT into toto1 values (:b1,lpad('a',1000,'a')) 
• Insert statement 
• Problem on a data block on 
• table toto1 
Solution: Freelists or ASSM
Lack of Free List 
S1 S2 S3 S4 
4 Sessions running 
Insert into toto1 
values (null, ‘a’); 
Commit; 
OBJN OTYPE FILEN BLOCKN SQL_ID BLOCK_TYPE 
----------- ------ ------ ------ ------------- ------------ 
54962 TOTO1 TABLE 16 45012 8gz51m9hg5yuf data block 
54962 TOTO1 TABLE 16 161 8gz51m9hg5yuf segment header
Buffer Busy on Index 
Solutions 
1. Hash Partitions 
2. Reverse Keys
Sampling Summary 
• Sampling v$session find root causes 
• Same data is in : 
• ASH - Active Session History 
• v$active_session_history
Ideas for Today 
OOEEMM 
AASSHH 
SSaammpplliinngg 
WWaaiittss
vv$$aaccttiivvee__sseessssiioonn__hhiissttoorryy 
SAMPLE_ID NUMBER 
SAMPLE_TIME TIMESTAMP(3) 
SESSION_ID NUMBER 
SESSION_SERIAL# NUMBER 
USER_ID NUMBER 
SERVICE_HASH NUMBER 
SESSION_TYPE VARCHAR2(10) 
PROGRAM VARCHAR2(64) 
MODULE VARCHAR2(48) 
ACTION VARCHAR2(32) 
CLIENT_ID VARCHAR2(64) 
SESSION_STATE VARCHAR2(7) 
WAIT_TIME NUMBER 
EVENT VARCHAR2(64) 
EVENT_ID NUMBER 
EVENT# NUMBER 
SEQ# NUMBER 
P1 NUMBER 
P2 NUMBER 
P3 NUMBER 
WAIT_TIME NUMBER 
TIME_WAITED NUMBER 
CURRENT_OBJ# NUMBER 
CURRENT_FILE# NUMBER 
CURRENT_BLOCK# NUMBER0 
SQL_ID VARCHAR2(13) 
SQL_CHILD_NUMBER NUMBER 
SQL_PLAN_HASH_VALUE NUMBER 
SQL_OPCODE NUMBER 
QC_SESSION_ID NUMBER 
QC_INSTANCE_ID NUMBER 
TIME_WAITED NUMBER 
When 
Session 
State 
Wait 
SQL 
Duration
PPrriimmaarryy FFiieellddss ooff AASSHH 
SAMPLE_TIME Time 
SESSION_ID 
SESSION_STATE : WAITING, ON CPU State 
EVENT : what kind of wait 
SQL_ID 
Session 
Wait 
SQL 
Activity : Who, What, When, How 
Be nice if these were combined
GGrroouuppiinnggss –– TToopp CCoonnssuummeerr 
SESSION_ID 
SESSION_SERIAL# (identify SID reuse) 
SESSION_TYPE (FOREGROUND,BACKGROUND) 
USER_ID (SYS, SYSTEM, SCOTT etc) 
SERVICE_HASH (OE,GL,HR) 
MODULE.ACTION (PLSQL tagging) 
CLIENT_ID (identifying users in session pool) 
PROGRAM (SQL, JDBC, Forms etc) 
SQL_ID 
QC_SESSION_ID (Query Coordinator) 
QC_INSTANCE_ID (RAC) 
EVENT + P1, P2, P3 
CURRENT_OBJ# 
CURRENT_FILE# 
CURRENT_BLOCK# 
Only for I/O, some locks and 
buffer busy waits
Counting is the key to ASH 
Seconds (i.e. DB Time) ~= count(*) 
Select count(*) 
from ASH 
where {criteria} 
and {time period};
Counting is the key to ASH 
AAS = DB Time/elapsed ~ = count(*)/elapsed 
Select count(*)/{time period in seconds} AAS 
from ASH 
where {criteria} 
and {time period}; 
AAS = load on the database
AAAASS FFoorrmmuullaass 
Use CPU count as yardstick: 
 AAS < 1 
Database is not blocked 
 AAS ~= 0 
Database basically idle 
Problems are in the APP not DB 
 AAS < # of CPUs 
CPU available 
Are any single sessions 100% active? 
• AAS > # of CPUs 
Could have performance problems 
 AAS >> # of CPUS 
There is a bottleneck 
Ideal world – 
one database 
solution 
track CPU at OS 
AAS > 1 
still want to know 
if a single user is 
100% active
TToopp CCPPUU SSeessssiioonn 
Top CPU consuming Session in last 5 minutes 
Select 
session_id, 
count(*) 
from 
v$active_session_history 
where 
session_state= ‘ON CPU‘ and 
SAMPLE_TIME > sysdate – (5/(24*60)) 
group by 
session_id 
order by 
count(*) desc; 
Select 
session_id, 
count(*) 
from 
v$active_session_history 
where 
session_state= ‘ON CPU‘ and 
SAMPLE_TIME > sysdate – (5/(24*60)) 
group by 
session_id 
order by 
count(*) desc; 
WWhhoo iiss tthhee rroogguuee sseessssiioonn ??
RReessuullttss TToopp CCPPUU SSeessssiioonn 
NNoott AAAASS,, wwhhaatt ddooeess 
ccoouunntt mmeeaann?? 
SESSION_ID COUNT(*) 
---------- ---------- 
SESSION_ID COUNT(*) 
---------- ---------- 
257 299 
263 62 
256 32 
264 9 
277 3 
257 299 
263 62 
256 32 
264 9 
277 3
TToopp CCPPUU SSeessssiioonn 
Top CPU consuming Session in last 5 minutes 
Select 
WWhhoo iiss tthhee rroogguuee sseessssiioonn ?? 
session_id, 
count(*)/(5*60) – COUNT/ELAPSED=AAS 
100*(count(*)/(5*60) ) -- % active 
from 
v$active_session_history 
where 
session_state= ‘ON CPU‘ and 
SAMPLE_TIME > sysdate – (5/(24*60)) 
group by 
session_id 
order by 
count(*) desc; 
Select 
session_id, 
count(*)/(5*60) – COUNT/ELAPSED=AAS 
100*(count(*)/(5*60) ) -- % active 
from 
v$active_session_history 
where 
session_state= ‘ON CPU‘ and 
SAMPLE_TIME > sysdate – (5/(24*60)) 
group by 
session_id 
order by 
count(*) desc; 
LLaasstt 55 mmiinnuutteess
RReessuullttss TToopp CCPPUU SSeessssiioonn 
AAS/100 = % active 
SESSION_ID AAS %busy 
---------- ---------- --------- 
SESSION_ID AAS %busy 
---------- ---------- --------- 
257 .99 99 
263 .21 21 
256 .11 11 
264 .03 3 
277 .01 1 
257 .99 99 
263 .21 21 
256 .11 11 
264 .03 3 
277 .01 1
Making a 0-100% bar 
Select 
session_id, count(*) , 
round((count(*)*100)/(5*60),0) "%", 
lpad('*', 
10 * (count(*)/(5*60)), 
10 characters wide 
'*') "Bar" 
From 
AAS per session 0-1 
v$active_session_history 
Where 
session_state= 'ON CPU' and 
SAMPLE_TIME > sysdate - (5/(24*60)) 
group by session_id 
order by count(*) desc 
/
CCPPUU wwiitthh BBaarrss 
SESSION_ID COUNT(*) % Bar 
---------- ---------- ---------- ------------ 
SESSION_ID COUNT(*) % Bar 
---------- ---------- ---------- ------------ 
257 299 99 |**********| 
263 62 21 |** | 
256 32 11 |* | 
264 9 3 | | 
277 3 1 | | 
258 1 0 | | 
280 1 0 | | 
257 299 99 |**********| 
263 62 21 |** | 
256 32 11 |* | 
264 9 3 | | 
277 3 1 | | 
258 1 0 | | 
280 1 0 | | 
BBaarr sshhoowwss 1100%% iinnccrreemmeennttss
TToopp WWaaiittiinngg SSeessssiioonn 
• in last 5 minutes 
Select 
session_id, 
count(*) 
from 
v$active_session_history 
where 
session_state=‘WAITING’ and 
SAMPLE_TIME > SYSDATE - (5/(24*60)) 
group by 
session_id 
order by 
count(*) desc; 
Select 
session_id, 
count(*) 
from 
v$active_session_history 
where 
session_state=‘WAITING’ and 
SAMPLE_TIME > SYSDATE - (5/(24*60)) 
group by 
session_id 
order by 
count(*) desc;
TToopp WWaaiittiinngg SSeessssiioonn RReessuullttss 
SESSION_ID COUNT(*) 
---------- ---------- 
SESSION_ID COUNT(*) 
---------- ---------- 
272 224 
254 8 
249 5 
276 5 
277 4 
270 1 
272 224 
254 8 
249 5 
276 5 
277 4 
270 1
TToopp SSQQLL ffrroomm AASSHH 
select 
ash.SQL_ID , 
sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", 
sum(decode(ash.session_state,'WAITING',1,0)) - 
sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "WAIT" , 
sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "IO" , 
sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL" 
from v$active_session_history ash, 
select 
ash.SQL_ID , 
sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", 
sum(decode(ash.session_state,'WAITING',1,0)) - 
sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "WAIT" , 
sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "IO" , 
sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL" 
from v$active_session_history ash, 
v$event_name en 
v$event_name en 
where SQL_ID is not NULL and en.event#=ash.event# 
group by sql_id 
order by sum(decode(session_state,'ON CPU',1,1)) desc 
where SQL_ID is not NULL and en.event#=ash.event# 
group by sql_id 
order by sum(decode(session_state,'ON CPU',1,1)) desc 
NNoo ttiimmee wwiinnddooww ssppeecciiffiieedd
TToopp SSQQLL ffrroomm AASSHH RReessuullttss 
SQL_ID CPU WAITING IO TOTAL 
------------- ---------- ---------- ---------- ---------- 
4c1xvq9ufwcjc 23386 0 0 23386 
6wjw6rz5uvbp3 99 0 23 122 
968dm8hr9qd03 97 0 22 119 
938jp5gasmrah 90 0 25 115 
cv8xnv81kf582 42 0 9 51 
6p9bzu19v965k 21 0 0 21 
5zu8pxnun66bu 15 0 0 15 
db2jr13nup72v 9 0 0 9 
7ks5gnj38hghv 8 0 0 8 
SQL_ID CPU WAITING IO TOTAL 
------------- ---------- ---------- ---------- ---------- 
4c1xvq9ufwcjc 23386 0 0 23386 
6wjw6rz5uvbp3 99 0 23 122 
968dm8hr9qd03 97 0 22 119 
938jp5gasmrah 90 0 25 115 
cv8xnv81kf582 42 0 9 51 
6p9bzu19v965k 21 0 0 21 
5zu8pxnun66bu 15 0 0 15 
db2jr13nup72v 9 0 0 9 
7ks5gnj38hghv 8 0 0 8
TToopp SSeessssiioonn 
select 
ash.session_id, 
ash.session_serial#, 
ash.user_id, 
ash.program, 
sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", 
sum(decode(ash.session_state,'WAITING',1,0)) - 
sum(decode(ash.session_state,'WAITING', 
select 
ash.session_id, 
ash.session_serial#, 
ash.user_id, 
ash.program, 
sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", 
sum(decode(ash.session_state,'WAITING',1,0)) - 
sum(decode(ash.session_state,'WAITING', 
select 
ash.session_id, 
ash.session_serial#, 
ash.user_id, 
ash.program, 
sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", 
sum(decode(ash.session_state,'WAITING',1,0)) - 
sum(decode(ash.session_state,'WAITING', 
decode(en.wait_class,'User I/O',1, 0 ), 0)) "WAITING" , 
sum(decode(ash.session_state,'WAITING', 
decode(en.wait_class,'User I/O',1, 0 ), 0)) "IO" , 
sum(decode(session_state,'ON CPU',1,1)) "TOTAL" 
from v$active_session_history ash, 
decode(en.wait_class,'User I/O',1, 0 ), 0)) "WAITING" , 
sum(decode(ash.session_state,'WAITING', 
decode(en.wait_class,'User I/O',1, 0 ), 0)) "IO" , 
sum(decode(session_state,'ON CPU',1,1)) "TOTAL" 
from v$active_session_history ash, 
decode(en.wait_class,'User I/O',1, 0 ), 0)) "WAITING" , 
sum(decode(ash.session_state,'WAITING', 
decode(en.wait_class,'User I/O',1, 0 ), 0)) "IO" , 
sum(decode(session_state,'ON CPU',1,1)) "TOTAL" 
from v$active_session_history ash, 
v$event_name en 
v$event_name en 
where en.event# = ash.event# 
group by session_id,user_id,session_serial#,program 
order by sum(decode(session_state,'ON CPU',1,1)) 
where en.event# v$event_= name ash.event# 
en 
group by session_id,user_id,session_serial#,program 
order by sum(decode(session_state,'ON CPU',1,1)) 
where en.event# = ash.event# 
group by session_id,user_id,session_serial#,program 
order by sum(decode(session_state,'ON CPU',1,1)) 
NNoo ttiimmee wwiinnddooww ssppeecciiffiieedd
TToopp SSeessssiioonn RReessuullttss 
SESSION_ID SERIAL# USER_ID PROGRAM CPU WAITING IO 
---------- ------- ------- ------------------------- ----- ------- ---- 
SESSION_ID SERIAL# USER_ID PROGRAM CPU WAITING IO 
---------- ------- ------- ------------------------- ----- ------- ---- 
247 61970 1 sqlplus 11698 0 0 
277 1 0 oracle@labsfrh903 (LGWR) 14 21 0 
276 1 0 oracle@labsfrh903 (CKPT) 19 10 0 
278 1 0 oracle@labsfrh903 (DBW0) 29 0 0 
280 1 0 oracle@labsfrh903 (PMON) 19 0 0 
254 22617 5 Executor.exe 13 0 3 
255 12877 5 Executor.exe 11 0 5 
257 33729 5 Executor.exe 15 0 1 
255 13417 5 Executor.exe 14 0 2 
247 61970 1 sqlplus 11698 0 0 
277 1 0 oracle@labsfrh903 (LGWR) 14 21 0 
276 1 0 oracle@labsfrh903 (CKPT) 19 10 0 
278 1 0 oracle@labsfrh903 (DBW0) 29 0 0 
280 1 0 oracle@labsfrh903 (PMON) 19 0 0 
254 22617 5 Executor.exe 13 0 3 
255 12877 5 Executor.exe 11 0 5 
257 33729 5 Executor.exe 15 0 1 
255 13417 5 Executor.exe 14 0 2
TToopp SSeessssiioonn ww// UUsseerrnnaammee 
select 
select 
decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED') 
decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED') 
"STATUS", 
"STATUS", 
topsession.session_id "SESSION_ID", 
u.name "NAME", 
topsession.program "PROGRAM", 
max(topsession.CPU) "CPU", 
max(topsession.WAITING) "WAITING", 
max(topsession.IO) "IO", 
max(topsession.TOTAL) "TOTAL" 
from {previous query} ) topsession , 
topsession.session_id "SESSION_ID", 
u.name "NAME", 
topsession.program "PROGRAM", 
max(topsession.CPU) "CPU", 
max(topsession.WAITING) "WAITING", 
max(topsession.IO) "IO", 
max(topsession.TOTAL) "TOTAL" 
from {previous query} ) topsession , 
v$session s, 
user$ u 
where 
AASSHH 
u.user# =topsession.user_id and 
/* outer join to v$session because the session might be disconnected */ 
topsession.session_id = s.sid (+) and 
topsession.session_serial# = s.serial# (+) 
group by topsession.session_id, topsession.session_serial#, topsession.user_id, 
topsession.program, s.username,s.sid,s.paddr,u.name 
order by max(topsession.TOTAL) desc 
v$session s, 
user$ u 
where 
u.user# =topsession.user_id and 
/* outer join to v$session because the session might be disconnected */ 
topsession.session_id = s.sid (+) and 
topsession.session_serial# = s.serial# (+) 
group by topsession.session_id, topsession.session_serial#, topsession.user_id, 
topsession.program, s.username,s.sid,s.paddr,u.name 
order by max(topsession.TOTAL) desc 
NNoo ttiimmee wwiinnddooww ssppeecciiffiieedd 
CCoonnnneecctteedd?? 
UUsseerr nnaammee
TToopp SSeessssiioonn 
FFiinnddiinngg aa RRoogguuee UUsseerr 
STATUS SESSION_ID NAME PROGRAM CPU WAITING IO 
--------------- ---------- ---------- ------------------------- ----- ---------- ---- 
CONNECTED 247 CPU_Monger ChMgr304.exe 11704 0 0 
CONNECTED 277 SYS oracle@labsfrh903 (LGWR) 14 19 0 
CONNECTED 278 SYS oracle@labsfrh903 (DBW0) 29 0 0 
CONNECTED 276 SYS oracle@labsfrh903 (CKPT) 18 9 0 
CONNECTED 280 SYS oracle@labsfrh903 (PMON) 20 0 0 
DISCONNECTED 255 SYSTEM Executor.exe 11 4 5 
DISCONNECTED 257 SYSTEM Executor.exe 13 0 3 
DISCONNECTED 255 SYSTEM Executor.exe 14 0 2 
DISCONNECTED 257 SYSTEM Executor.exe 13 0 3 
STATUS SESSION_ID NAME PROGRAM CPU WAITING IO 
--------------- ---------- ---------- ------------------------- ----- ---------- ---- 
CONNECTED 247 CPU_Monger ChMgr304.exe 11704 0 0 
CONNECTED 277 SYS oracle@labsfrh903 (LGWR) 14 19 0 
CONNECTED 278 SYS oracle@labsfrh903 (DBW0) 29 0 0 
CONNECTED 276 SYS oracle@labsfrh903 (CKPT) 18 9 0 
CONNECTED 280 SYS oracle@labsfrh903 (PMON) 20 0 0 
DISCONNECTED 255 SYSTEM Executor.exe 11 4 5 
DISCONNECTED 257 SYSTEM Executor.exe 13 0 3 
DISCONNECTED 255 SYSTEM Executor.exe 14 0 2 
DISCONNECTED 257 SYSTEM Executor.exe 13 0 3
Queries can be complicated 
• Key to ASH 
• Difficulties 
• Pitfalls 
• Solution
Keys to ASH 
1. Seconds = 
COUNT(*) 
1. AAS = 
COUNT(*) / Elapsed 
1. Combine CPU state with EVENT 
decode(session_state, 
'ON CPU','ON CPU’, 
EVENT)
Queries can be complicated
Solution: ASH Masters, Collection of ASH SQL 
scripts 
1.Load Charts 
2.Wait Analysis – locks, latches, bbw 
3.SQL elapsed times 
4.Top – sql, session, wait, procedure, object 
5.I/O 
•Latency * - not from ASH, but important and related
54 
BBeeffoorree AASSHH MMaasstteerrss 
remember ashrpt.sql 
1. ASHRPT 
– Based entirely on v$active_session_history 
– @?/rdbms/admin/ashrpt.sql 
– Exec ASH_REPORT_TEXT/HTML 
sseelleecctt ** ffrroomm ttaabbllee 
((ddbbmmss__wwoorrkkllooaadd__rreeppoossiittoorryy..aasshh__rreeppoorrtt__tteexxtt(( 
((sseelleecctt ddbbiidd ffrroomm vv$$ddaattaabbaassee)),, 
11,, 
ssyyssddaattee –– 11//2244,, 
ssyyssddaattee )))) ;;
AASSHHRRPPTT 
AASSHH RReeppoorrtt FFoorr TTEESSTTDDBB//tteessttddbb 
DDBB NNaammee DDBB IIdd IInnssttaannccee IInnsstt NNuumm RReelleeaassee RRAACC HHoosstt 
------------------------ ---------------------- ------------------------ ---------------- ---------------------- ------ ------------------------ 
TTEESSTTDDBB 22337711557700553388 tteessttddbb 11 1100..22..00..11..00 NNOO ssddbbee660044aa 
CCPPUUss SSGGAA SSiizzee BBuuffffeerr CCaacchhee SShhaarreedd PPooooll AASSHH BBuuffffeerr SSiizzee 
-------- ------------------------------------ ------------------------------------ ------------------------------------ ------------------------------------ 
AASSHH RReeppoorrtt FFoorr TTEESSTTDDBB//tteessttddbb 
DDBB NNaammee DDBB IIdd IInnssttaannccee IInnsstt NNuumm RReelleeaassee RRAACC HHoosstt 
------------------------ ---------------------- ------------------------ ---------------- ---------------------- ------ ------------------------ 
TTEESSTTDDBB 22337711557700553388 tteessttddbb 11 1100..22..00..11..00 NNOO ssddbbee660044aa 
CCPPUUss SSGGAA SSiizzee BBuuffffeerr CCaacchhee SShhaarreedd PPooooll AASSHH BBuuffffeerr SSiizzee 
-------- ------------------------------------ ------------------------------------ ------------------------------------ ------------------------------------ 
22 11,,000000MM ((110000%%)) 446688MM ((4466..88%%)) 111122MM ((1111..22%%)) 44..00MM ((00..44%%)) 
22 11,,000000MM ((110000%%)) 446688MM ((4466..88%%)) 111122MM ((1111..22%%)) 44..00MM ((00..44%%)) 
AAnnaallyyssiiss BBeeggiinn TTiimmee:: 2211--AApprr--0066 1122::0000::0011 
AAnnaallyyssiiss BBeeggiinn TTiimmee:: 2211--AApprr--0066 1122::0000::0011 
AAnnaallyyssiiss EEnndd TTiimmee:: 2211--AApprr--0066 1122::0055::0011 
AAnnaallyyssiiss EEnndd TTiimmee:: 2211--AApprr--0066 1122::0055::0011 
EEllaappsseedd TTiimmee:: 55..00 ((mmiinnss)) 
SSaammppllee CCoouunntt:: 33,,771166 
EEllaappsseedd TTiimmee:: 55..00 ((mmiinnss)) 
SSaammppllee CCoouunntt:: 33,,771166 
AAvveerraaggee AAccttiivvee SSeessssiioonnss:: 1122..3399 
AAvveerraaggee AAccttiivvee SSeessssiioonnss:: 1122..3399 
AAvvgg.. AAccttiivvee SSeessssiioonn ppeerr CCPPUU:: 66..1199 
AAvvgg.. AAccttiivvee SSeessssiioonn ppeerr CCPPUU:: 66..1199 
RReeppoorrtt TTaarrggeett:: NNoonnee ssppeecciiffiieedd 
RReeppoorrtt TTaarrggeett:: NNoonnee ssppeecciiffiieedd 
TToopp UUsseerr EEvveennttss DDBB//IInnsstt:: TTEESSTTDDBB//tteessttddbb ((AApprr 2211 1122::0000 ttoo 1122::0055)) 
TToopp UUsseerr EEvveennttss DDBB//IInnsstt:: TTEESSTTDDBB//tteessttddbb ((AApprr 2211 1122::0000 ttoo 1122::0055)) 
AAvvgg AAccttiivvee 
AAvvgg AAccttiivvee 
EEvveenntt EEvveenntt CCllaassss %% AAccttiivviittyy SSeessssiioonnss 
---------------------------------------------------------------------- ------------------------------ -------------------- -------------------- 
CCPPUU ++ WWaaiitt ffoorr CCPPUU CCPPUU 6677..9988 88..4422 
eennqq:: TTXX -- rrooww lloocckk ccoonntteennttiioonn AApppplliiccaattiioonn 2233..9988 22..9977 
bbuuffffeerr bbuussyy wwaaiittss CCoonnccuurrrreennccyy 44..6666 00..5588 
llaattcchh:: ccaacchhee bbuuffffeerrss cchhaaiinnss CCoonnccuurrrreennccyy 22..2266 00..2288 
EEvveenntt EEvveenntt CCllaassss %% AAccttiivviittyy SSeessssiioonnss 
---------------------------------------------------------------------- ------------------------------ -------------------- -------------------- 
CCPPUU ++ WWaaiitt ffoorr CCPPUU CCPPUU 6677..9988 88..4422 
eennqq:: TTXX -- rrooww lloocckk ccoonntteennttiioonn AApppplliiccaattiioonn 2233..9988 22..9977 
bbuuffffeerr bbuussyy wwaaiittss CCoonnccuurrrreennccyy 44..6666 00..5588 
llaattcchh:: ccaacchhee bbuuffffeerrss cchhaaiinnss CCoonnccuurrrreennccyy 22..2266 00..2288
AASSHH RRPPTT 
1) General info 
2) Top User Events *** 
3) Top Background Events 
4) Top Event P1/P2/P3 Values 
5) Top Service/Module 
6) Top Client IDs 
7) Top SQL Command Types 
8) Top SQL Statements *** 
1) General info 
2) Top User Events *** 
3) Top Background Events 
4) Top Event P1/P2/P3 Values 
5) Top Service/Module 
6) Top Client IDs 
7) Top SQL Command Types 
8) Top SQL Statements *** 
9) Top SQL using literals 
10) Top Sessions *** 
11) Top Blocking Sessions 
12) Top Sessions running PQs 
13) Top DB Objects 
14) Top DB Files 
15) Top Latches 
16) Activity Over Time *** 
9) Top SQL using literals 
10) Top Sessions *** 
11) Top Blocking Sessions 
12) Top Sessions running PQs 
13) Top DB Objects 
14) Top DB Files 
15) Top Latches 
16) Activity Over Time ***
AASSHHRRPPTT oovveerr TTiimmee 
•Waits over Time 
–Not in AAS 
• Difficult but better 
than nothing
ASH Masters 
intro to github 
1.Load Charts 
2.Wait Analysis – locks, latches, bbw 
3.SQL elapsed times 
4.Top – sql, session, wait, procedure, object 
5.I/O – size, object 
Extra: Latency * - not from ASH, but important
ASH Masters on github.com 
• https://github.com/khailey/ashmasters
ASH Masters README.md
1. Load Charts 
How to get a quick overview of all the data in the ASH ? 
Reproduce Active Session OEM tab in SQL 
1. Load graph 
2. Add Top waits 
3. Then from dba_hist_active_sess_history
11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh..ssqqll 
@ash_graph 
TIME AAS GRAPH 
---------------- ------- ---------------------- 
06-AUG 14:00:00 2.24 ++--------2--- 
06-AUG 15:00:00 6.67 ++++------2---------- 
06-AUG 16:00:00 2.59 ++--------2---- 
06-AUG 17:00:00 1.26 ++----- 2 
06-AUG 18:00:00 1.38 +++---- 2 
06-AUG 19:00:00 1.74 ++------- 2 
06-AUG 20:00:00 .99 +---- 2 
06-AUG 21:00:00 1.22 ++----- 2 
06-AUG 22:00:00 1.66 ++------ 2 
06-AUG 23:00:00 1.08 +---- 2 
07-AUG 00:00:00 .83 +--- 2 
07-AUG 01:00:00 1.74 ++------- 2 
07-AUG 02:00:00 2.47 ++--------2---- 
07-AUG 03:00:00 6.59 +++-------2---------- 
@ash_graph 
TIME AAS GRAPH 
---------------- ------- ---------------------- 
06-AUG 14:00:00 2.24 ++--------2--- 
06-AUG 15:00:00 6.67 ++++------2---------- 
06-AUG 16:00:00 2.59 ++--------2---- 
06-AUG 17:00:00 1.26 ++----- 2 
06-AUG 18:00:00 1.38 +++---- 2 
06-AUG 19:00:00 1.74 ++------- 2 
06-AUG 20:00:00 .99 +---- 2 
06-AUG 21:00:00 1.22 ++----- 2 
06-AUG 22:00:00 1.66 ++------ 2 
06-AUG 23:00:00 1.08 +---- 2 
07-AUG 00:00:00 .83 +--- 2 
07-AUG 01:00:00 1.74 ++------- 2 
07-AUG 02:00:00 2.47 ++--------2---- 
07-AUG 03:00:00 6.59 +++-------2---------- 
What is this ?
11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh..ssqqll 
@ash_graph 
TIME AAS GRAPH 
---------------- ------- ---------------------- 
06-AUG 13:00:00 .33 +- 2 
06-AUG 14:00:00 2.24 ++--------2--- 
06-AUG 15:00:00 6.67 ++++------2---------- 
06-AUG 16:00:00 2.59 ++--------2---- 
06-AUG 17:00:00 1.26 ++----- 2 
06-AUG 18:00:00 1.38 +++---- 2 
06-AUG 19:00:00 1.74 ++------- 2 
06-AUG 20:00:00 .99 +---- 2 
06-AUG 21:00:00 1.22 ++----- 2 
06-AUG 22:00:00 1.66 ++------ 2 
06-AUG 23:00:00 1.08 +---- 2 
07-AUG 00:00:00 .83 +--- 2 
07-AUG 01:00:00 1.74 ++------- 2 
07-AUG 02:00:00 2.47 ++--------2---- 
07-AUG 03:00:00 6.59 +++-------2---------- 
07-AUG 04:00:00 1.95 ++++++--- 2 
07-AUG 05:00:00 3.08 +++++-----2------ 
@ash_graph 
TIME AAS GRAPH 
---------------- ------- ---------------------- 
06-AUG 13:00:00 .33 +- 2 
06-AUG 14:00:00 2.24 ++--------2--- 
06-AUG 15:00:00 6.67 ++++------2---------- 
06-AUG 16:00:00 2.59 ++--------2---- 
06-AUG 17:00:00 1.26 ++----- 2 
06-AUG 18:00:00 1.38 +++---- 2 
06-AUG 19:00:00 1.74 ++------- 2 
06-AUG 20:00:00 .99 +---- 2 
06-AUG 21:00:00 1.22 ++----- 2 
06-AUG 22:00:00 1.66 ++------ 2 
06-AUG 23:00:00 1.08 +---- 2 
07-AUG 00:00:00 .83 +--- 2 
07-AUG 01:00:00 1.74 ++------- 2 
07-AUG 02:00:00 2.47 ++--------2---- 
07-AUG 03:00:00 6.59 +++-------2---------- 
07-AUG 04:00:00 1.95 ++++++--- 2 
07-AUG 05:00:00 3.08 +++++-----2------
11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh..ssqqll 
“-” = WAIT 
“+” = CPU 
which waits ?
11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh__wwaaiittss..ssqqll 
ash_graph_ash.sql aaddff 
Top Two Waits
11.. LLooaadd CChhaarrttss:: bbaassiiccss,, ffaakkee qquueerryy 
Select pseudo columns 
start_time 
, bucket_id 
, count(cpu) 
, count(waits) 
from 
v$active_session_history ash 
START_TIME BUCKET_ID CPU WAITS 
---------- ------------- ---------- ---------- 
25-NOV-13 55 397 28231 
25-NOV-13 56 80 5631
11.. LLooaadd CChhaarrttss:: ccoommppoonneennttss 
ID 
ID = truncate ( seconds in date / seconds in bucket ) 
(( Julian days * seconds in a day ) + (seconds in last day)) / bucket size in seconds 
trunc((to_char(sample_time,'J')*(24*60*60)+ 
to_char(sample_time,'SSSSS'))/&v_secs) 
Counts 
, sum(decode(session_state,'ON CPU',1,0)) cpu 
, sum(decode(session_state,'WAITING',1,0)) waits
11.. LLooaadd CChhaarrttss:: rreeaall qquueerryy 
select 
trunc((to_char(sample_time,'J')*(24*60*60)+ 
ID 
to_char(sample_time,'SSSSS'))/&v_secs) id 
CPU 
, sum(decode(session_state,'ON CPU',1,0)) cpu 
, sum(decode(session_state,'WAITING',1,0)) waits 
from 
v$active_session_history ash 
-- dba_hist_active_sess_history 
group by 
trunc((to_char(sample_time,'J')*(24*60*60)+ 
to_char(sample_time,'SSSSS'))/&v_secs) 
ID CPU WAITS 
---------- ---------- ---------- 
4.2432E+10 1 4 
4.2432E+10 9 18 
4.2432E+10 8 25 
4.2432E+10 9 26 
Waits 
Group by 
ID
1. Load Charts: how ddoo yyoouu ddrraaww aa llooaadd lliinnee?? 
If the value of 1 AAS is 5 characters wide then 
+++++----- 
Above is AAS of 2 (1 wait, 1 CPU) 
AAS Width of AAS 
rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || 
rpad('-',round((waits/&v_secs)*&v_bars),'-') || 
Def v_secs=60 -- size bucket in seconds 
Def v_bars=5 -- size of one AAS
11.. LLooaadd CChhaarrttss:: bbaassiiccss :: ggrraapphhiiccss 
rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || 
rpad('-',round((waits/&v_secs)*&v_bars),'-') || 
rpad(' ',p.value * &v_bars,' '), -- blanks 
+++++----- 
1 
+++++----- 
+++++1----- 
Trick, add in the number cores 
1.Draw full line, cut at core # 
2.Add core # 
3.Draw full line again cut before first core # 
|| 
|| 
What about a yard stick ?
11.. LLooaadd CChhaarrttss:: ggrraapphhiiccss 
Def v_bars=5 -- size of one AAS in characters 
Def v_graph=80 
substr( 
substr( 
rpad('+',round((cpu*&v_bars)/&v_secs),'+') || 
rpad('-',round((waits*&v_bars)/&v_secs),'-') || 
rpad(' ',p.value * &v_bars,' '), 
0,(p.value * &v_bars)) || 
p.value || 
substr( 
First half 
of line 
Add core count 
rpad('+',round((cpu*&v_bars)/&v_secs),'+') || 
rpad('-',round((waits*&v_bars)/&v_secs),'-') || 
rpad(' ',p.value * &v_bars,' '), 
(p.value * &v_bars)) 
,0,&v_graph) 
2nd half 
of line 
+++++----- 
1 
+++++-----
11.. LLooaadd CChhaarrttss:: bbaassiiccss 
select 
Date (from ID) 
to_char(to_date( trunc((id*&v_secs)/ (24*60*60)) || ' ' || -- Julian days 
mod((id*&v_secs), (24*60*60)) -- seconds in the day 
, 'J SSSSS' ), 'MON DD YYYY HH24:MI:SS') start_time, 
substr( substr( 
rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || 
rpad('-',round((waits/&v_secs)*&v_bars),'-') || 
rpad(' ',p.value * &v_bars,' ’) ,0,(p.value * &v_bars)) || 
p.value || 
substr( 
rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || 
rpad('-',round((waits/&v_secs)*&v_bars),'-') || 
rpad(' ',p.value * &v_bars,' '), (p.value * &v_bars)) 
,0,&v_graph) graph 
Graphics 
from ( 
select trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) 
id 
, sum(decode(session_state,'ON CPU',1,0)) cpu 
, sum(decode(session_state,'WAITING',1,0)) waits 
from v$active_session_history ash 
group by 
CPU 
trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) 
) aveact, 
v$parameter p 
where p.name='cpu_count' 
order by id 
Bar 
ID 
WAITS 
RAW
1. Load Charts : ash_graph.sql 
START_TIME GRAPH 
-------------------- -------------------------- 
NOV 03 2013 22:02:00 ++---1------ 
NOV 03 2013 22:03:00 ++---1------ 
NOV 03 2013 22:04:00 +++--1------- 
NOV 03 2013 22:05:00 +----1- 
NOV 03 2013 22:06:00 +++--1-- 
When waiting, 
which are the top waits ?
1. Load Charts : events ash_graph_waits.sql 
Select 
trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) Bucket_id 
, decode(session_state,'ON CPU','ON CPU',ash.event) event 
, count(*) event_count 
From 
v$active_session_history ash 
group by 
trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) 
, decode(session_state,'ON CPU','ON CPU',ash.event) 
BUCKET_ID EVENT EVENT_COUNT 
---------- ------------------------------- ----------- 
3537592817 control file heartbeat 2 
3537592818 ADR block file read 1 
3537592818 ARCH wait for process start 3 3 
3537592818 ON CPU 9 
3537592818 control file parallel write 4
1. Load Charts : per bucket, rank the waits 
select 
id 
, event 
, row_number() over ( partition by id order by event_count desc ) rank 
, ratio_to_report( event_count ) over ( partition by id ) pct 
, sum(decode(event,'ON CPU',event_total,0)) cpu 
, sum(decode(event,'ON CPU',0,event_total)) waits 
from ( Previous Query ) chunks 
group by id, event, event_total 
ID EVENT RANK PCT CPU WAITS 
---------- ----------------------------- ---- --- ---- ----- 
3537592818 ON CPU 1 .290 9 0 
3537592818 db file sequential read 2 .161 0 5 
3537592818 log file switch (checkpoint i 3 .161 0 5 
3537592818 control file parallel write 4 .129 0 4 
3537592818 ARCH wait for process start 5 .096 0 3 
3537592818 ADR block file read 6 .032 0 1 
Rank 
Rank 
%
1. Load Charts : raw data ash_graph_waits.sql 
select id 
, round(max(decode(top.rank,1,pct,null)),2) fpct 
, max( 
decode(top.rank,1,decode(top.event,'ON CPU','CPU',event),null)) first 
, round(max(decode(top.rank,2,pct,null)),2) spct 
, max( 
decode(top.rank,2,decode(top.event,'ON CPU','CPU',event),null)) second 
, sum(waits) waits 
, sum(cpu) cpu 
… 
ID FPCT FIRST SPCT SECOND WAITS CPU 
---------- ----- --------------- ----- --------------- ---------- ------ 
3537592817 1.00 control file he 2 0 
3537592818 .29 CPU .16 db file sequent 22 9 
3537592819 .72 control file pa .14 CPU 37 6 
3537592820 .75 CPU .25 control file pa 1 3 
3537592821 .91 CPU .09 direct path rea 1 10
1. Load Charts : ash_graph_waits.sql 
TO_CHAR( PCT1 FIRST PCT2 SECOND GRAPH 
-------- ---- --------------- ---- --------------- ---------------------------------------- 
15 19:00 64 CPU 21 db file sequent ++o 4 
15 20:00 63 CPU 19 read by other s ++++o- 4 
15 21:00 31 db file sequent 24 CPU ++ooo---- 4 
15 22:00 35 CPU 24 db file scatter +++++ooooooo--- 4 
15 23:00 29 log file sync 25 db file sequent ++++ooooooooo-------4------------- 
16 00:00 52 db file sequent 27 CPU ++++++++++oooooooooo4ooooooooooooooo-- 
16 01:00 57 CPU 36 db file sequent +++++++++++oooooooo 4 
16 02:00 38 db file sequent 21 CPU ++++++oooooooooooo--4--------- 
16 03:00 69 db file sequent 20 CPU +++ooooooooooo 4 
16 04:00 45 db file sequent 28 CPU o 4 
16 05:00 58 db file sequent 24 CPU +ooo 4 
16 06:00 41 db file sequent 39 CPU +oo 4 
o = I/O 
+ = cpu 
- = wait 
OK, what about yesterday?
1. Load Charts : 
dba_hist_active_sess_history? 
dba_hist_active_sess_history 
•Week of ASH data !! (or more) 
•Only 1 in 10 v$active_session_history rows kept 
•Has DBID 
– Can query different databases in same repository 
MMiinnuutteess 
eexxeecc ddbbmmss__wwoorrkkllooaadd__rreeppoossiittoorryy..mmooddiiffyy__ssnnaappsshhoott__sseettttiinnggss((1144**2244**6600,,6600));; 
SELECT retention, snap_interval FROM wwrrmm$$__wwrr__ccoonnttrrooll;; 
RREETTEENNTTIIOONN SSNNAAPP__IINNTTEERRVVAALL 
---------------------------------- ---------------------------------- 
++0000001144 0000::0000::0000..00 ++0000000000 0011::0000::0000..00
1. Load Charts: queries with history 
• V$ACTIVE_SESSION_HISTORY - live 
– ash_graph_waits.sql – minute buckets 
Fast, in memory 
• V$ACTIVE_SESSION_HISTORY + 
slower 
DBA_HIST_ACTIVE_SESS_HISTORY – combine 
– ash_graph_waits_histash.sql – minute buckets 
• DBA_HIST_ACTIVE_SESS_HISTORY - history only (DBID) 
– ash_graph_histash_by_dbid.sql - input DBID 
repositories 
– ash_graph_histash_by_dbid_program.sql - input DBID and PROGRAM 
– ash_graph_histash_by_dbid_sqlid.sql - input DBID and a SQL_ID
2. SQL Elapsed times (11g+ ) 
ASH 11g added 
sql_exec_id 
sql_exec_start 
A SQL executing longer than 1 second will have same 
will 
•sql_exec_id 
•sql_exec_start 
•sql_id
2. SQL Elapsed times 
• ash_sql_elapsed.sql 
– longest running SQL 
SQL_ID COUNT(*) MX AV MIN 
------------- ---------- ------- --------- ---------- 
0fvrpk7476b7y 26 3068 133.1 0 
1pjp66rxcj6tg 15 3106 767.7 57 
• ash_sql_elapsed_hist.sql 
– with histogram of execution times 
SQL_ID CT MX MN AV 1 2 3 4 5 
------------- ---------- ---------- ---------- -------- ------ ------ ----- ----- ----- 
5k7vccwjr5ahd 2653 1963 0 33.4 2623 15 8 4 3 
ds8cz0fb8w147 161 2531 13 273.8 136 18 5 1 1 
• ash_sql_elapsed_hist_longestid.sql 
– execution id of longest running query 
SQL_ID CT MX MN AV MAX_RUN_TIME LONGEST_SQ 1 2 3 4 5 
------------- ------ ---------- ---- -------- ----------------------------------- ---------- ------ ------ ----- ---- --- 
2spgk3k0f7quz 251 29607 0 546.0 11-04-12 12:11:47 11-04-12 20:25:14 16781748 247 2 0 0 2 
990m08w8xav7s 591 7681 0 52.0 11-04-13 00:39:27 11-04-13 02:47:28 16786685 587 0 0 2 2
2. SQL Elapsed times: 
ash_sql_elapsed.sql 
SQL_ID Executions MX AV MIN 
------------- ---------- ------- --------- ---------- 
0fvrpk7476b7y 26 3068 133.1 0 
1pjp66rxcj6tg 15 3106 767.7 57 
8r5wuxk1dprhr 39 3510 841.0 24 
0w5uu5kngyyty 21 3652 442.3 0 
0hbv80w9ypy0n 161 4089 1183.9 0 
71fwb4n6a92fv 49 4481 676.9 30 
0bujgc94rg3fj 604 4929 24.7 0 
64dqhdkkw63fd 1083 7147 7.2 0 
990m08w8xav7s 591 7681 51.8 0 
2n5369dsuvn5a 16 10472 5726.8 303 
2spgk3k0f7quz 251 29607 546.1 0 
36pd759xym9tc 12 37934 23861.9 1391 
497wh6n7hu14f 49 69438 5498.2 0
2. SQL Elapsed times : raw data 
seconds query had been running = Sample_time – sql_exec_start 
select 
sql_id, 
sql_exec_id, 
id Seconds running 
(cast(sample_time as date) – cast(sql_exec_start as date)) * (60*60*24) tm 
from 
v$active_session_history 
where sql_exec_id is not null 
now select max seconds for each sql_exec_id
2. SQL Elapsed times 
select 
sql_id, 
sql_exec_id, 
max(tm) tm 
from ( previous query ) 
Final execution time is max of all execs 
SQL_ID SQL_EXEC_ID TM 
------------- ----------- ---------- 
acc988uzvjmmt 16777220 3 
acc988uzvjmmt 16777335 15 
acc988uzvjmmt 16779830 1 
acc988uzvjmmt 16781502 7
2. SQL Elapsed times 
select 
sql_id, 
count(*), 
max(tm) mx, 
avg(tm) av, 
min(tm) min 
from ( previous query ) 
each SQL_ID 
•max 
•min 
•average 
execution times 
SQL_ID COUNT(*) MX AV MIN 
------------- ---------- ------- --------- ---------- 
acc988uzvjmmt 4 15 6.5 1
2. SQL Elapsed times: ash_sql_elapsed.sql 
SQL_ID COUNT(*) MX AV MIN 
------------- ---------- ------- --------- ---------- 
0fvrpk7476b7y 26 3068 133.1 0 
1pjp66rxcj6tg 15 3106 767.7 57 
8r5wuxk1dprhr 39 3510 841.0 24 
0w5uu5kngyyty 21 3652 442.3 0 
0hbv80w9ypy0n 161 4089 1183.9 0 
71fwb4n6a92fv 49 4481 676.9 30 
0bujgc94rg3fj 604 4929 24.7 0 
64dqhdkkw63fd 1083 7147 7.2 0 
What was the distribution?
2. SQL Elapsed times: ash_sql_elapsed_hist.sql 
Histogram buckets: elapsed time spread 
SQL_ID CT MX MN AV 1 2 3 4 5 
------------- ---------- ------- ------- -------- ------ ------ ----- ----- -- 
401ayw4r7n6kz 1 1983 1983 1983.0 0 0 0 0 1 
30hzp85f3qtxj 179 3029 29 111.0 177 1 0 0 1 
9k86k2zvht9pt 1 3052 3052 3052.0 0 0 0 0 1 
bnddu47dqmzqd 10 3138 68 732.3 7 1 1 0 1 
gc7khrc2mx86m 1 3618 3618 3618.0 0 0 0 0 1 
8rua4c9agcqkb 978 820 0 72.7 830 116 21 9 2 
Bucket interval = max time / 5 
820/5 = 164 
1. 0 – 164 830 executions 
2. 165 – 328 115 executions 
3. 329 – 492 21 executions 
4. 493 – 656 9 executions 
5. 657 – 820 2 executions
2. SQL Elapsed Times ash_sql_elapsed_hist_longestid.sql 
OK found the longest but 
•When did it happen? 
•What was the sql_exec_id of the longest? 
SQL_ID CT MX MN AV MAX_RUN_TIME LONGEST_SQ 1 2 3 4 5 
------------- ---- ------ ---- ------ ----------------------------------- ---------- ------ ------ ----- ---- --- 
30hzp85f3qtxj 179 3029 29 111.0 11-11-07 13:46:12 11-11-07 14:36:41 16777250 177 1 0 0 1 
C61wk6d7ssxxc 20 1801 258 743.0 11-11-07 12:01:02 11-11-07 12:31:03 16777216 13 2 0 0 5 
769uu28qm4thw 17 1427 0 479.0 11-11-07 14:04:02 11-11-07 14:27:49 16777762 10 2 2 1 2 
Fuzcbdt08xjcd 74 315 33 248.0 11-11-07 12:10:05 11-11-07 12:15:20 16790567 5 4 9 5 51 
Bkv51bug8ag7c 29 307 1 36.0 11-11-07 11:58:30 11-11-07 12:03:37 16790749 26 2 0 0 1 
1wgsn7mmf6kqc 131 299 0 6.0 11-11-07 12:01:08 11-11-07 12:06:07 16784143 130 0 0 0 1 
3b7q0hd1q8pw0 17 288 1 118.0 11-11-07 09:42:21 11-11-07 09:47:09 16794374 7 4 0 1 5 
1v6yyfy630rkj 13 135 42 65.0 11-11-07 07:49:12 11-11-07 07:51:27 16816140 7 4 1 0 1 
1t715k5p9uxxx 50 95 0 32.0 11-11-07 05:17:55 11-11-07 05:19:30 16777225 32 1 1 0 16 
A98fbc69py0us 11 91 59 74.0 11-11-07 14:55:55 11-11-07 14:57:26 16777389 1 4 3 2 1 
0g53kf4gr3vrg 25 53 32 46.0 11-11-07 15:35:31 11-11-07 15:36:24 16777588 1 0 5 14 5 
start End
2. SQL Elapsed Times – lookup by SQL ID 
Select 
decode(session_state,'ON CPU','ON CPU’, event) 
From 
v$active_session_history 
Where 
sql_exec_id = 16777217 
Order by sample_id 
D E CODE(SESSION_STATE,'ONCPU','ONCPU',EVENT) 
------------------------------------------------ 
db file parallel read 
db file sequential read 
ON CPU 
ON CPU 
ON CPU 
ON CPU
3. Wait Analysis: v$active_session_history 
• Buffer busy waits 
• Enqueue transaction waits
3. Wait Analysis: buffer busy waits 
Top 5 Timed Events 
~~~~~~~~~~~~~~~~~~ % Total 
Event Waits Time (s) Call Time 
-------------------------------------------- ------------ ----------- --------- 
buffer busy waits 2,748 250 78.72 
CPU time 32 10.16 
free buffer waits 1,588 15 4.63 
write complete waits 10 8 2.51 
log buffer space 306 5 1.51 
------------------------------------------------------------ 
Buffer Busy Wait – trying to modify a block 
Who blocks? 
What object? 
what is the SQL? 
AWR fails
3. Wait Analysis: buffer busy waits 
To solve Buffer Busy Waits, need 
•Block type 
•Object 
• Table w/ data block => ASM or Freelists, 
• Index w/data block => reverse or hash partition 
•File 
• Temp files problem with extents 
ash_bbw.sql 
OBJN OTYPE FILEN BLOCKN SQL_ID BLOCK_TYPE 
------------------------- ----------- ------ ------------- ------------ 
53218 BBW_INDEX_VAL_I INDEX 1 64826 97dgthz60u28d data block 1 
53218 BBW_INDEX_VAL_I INDEX 1 64826 gypmcfzruu249 data block 1 
53218 BBW_INDEX_VAL_I INDEX 1 64826 2vd1w5kgnfa5n data block 1 
53218 BBW_INDEX_VAL_I INDEX 1 64826 3p3qncvp2juxs data block 1 
53218 BBW_INDEX_VAL_I INDEX 1 64826 6avm49ys4k7t6 data block 1
3. Wait Analysis: Joining ASH with v$waitstat 
select 
o.object_name obj, 
o.object_type otype, 
ash.SQL_ID, 
w.class 
from v$active_session_history ash, 
( select rownum class#, class from v$waitstat ) w, 
all_objects o 
where event='buffer busy waits' 
and w.class#(+)=ash.p3 
and o.object_id (+)= ash.CURRENT_OBJ# 
Order by sample_time; 
OBJ OTYPE SQL_ID CLASS 
------ ------ ------------- ------------------ 
TOTO1 TABLE 8gz51m9hg5yuf data block 
TOTO1 TABLE 8gz51m9hg5yuf data block 
TOTO1 TABLE 8gz51m9hg5yuf segment header 
TOTO1 TABLE 8gz51m9hg5yuf data block
3. Wait Analysis: How to get Class Name 
select rownum n,ws.class 
from v$waitstat; 
select * from v$event_name 
where name = 'buffer busy waits' 
NAME P1 P2 P3 
----------------- ----- ------ ----- 
buffer busy waits file# block# class# 
NAME P1 P2 P3 
----------------- ----- ------ ----- 
buffer busy waits file# block# class# 
N CLASS 
1 data block 
2 sort block 
3 save undo block 
4 segment header 
5 save undo header 
6 free list 
7 extent map 
8 1st level bmb 
9 2nd level bmb 
10 3rd level bmb 
11 bitmap block 
12 bitmap index block 
13 file header block 
14 unused 
15 system undo header 
16 system undo block 
17 undo header 
P3 = class#, how do we get class name?
3. Wait Analysis: tx enqueues 
Top 5 Timed Events Avg %Total 
~~~~~~~~~~~~~~~~~~ wait Call 
Event Waits Time (s) (ms) Time 
----------------------------------------- ------------ ----------- ------ ------ 
enq: TX - row lock contention 59 160 2714 41.8 
PL/SQL lock timer 4 117 29291 30.6 
CPU time 28 7.2 
buffer busy waits 1,217 18 15 4.7 
log file parallel write 422 11 27 3.0 
Who is waiting? 
Who is blocking? 
What is the SQL? 
What is the row? 
Not in AWR report
3. Wait Analysis: buffer busy waits 
vv$$aaccttiivvee__sseessssiioonn__hhiissttoorryy 
• Waiter 
– SESSION_ID 
– SESSION_SERIAL# 
– USER_ID 
• Object 
– CURRENT_OBJ# 
– CURRENT_FILE# 
– CURRENT_BLOCK# 
• SQL Waiting 
- SQL_ID 
• Blocker 
- BLOCKING_SESSION 
- BLOCKING_SESSION_STATUS 
- BLOCKING_SESSION_SERIAL# 
• Lock Type and Mode 
- Event = Type (name) 
- P1 = Type | Mode
3. Wait Analysis: tx enqueue waits 
select 
ash_enq.sql 
to_char(sample_time,’HH MI’) st, 
substr(event,0,20) lock_name, 
ash.session_id waiter, 
mod(ash.p1,16) lmode, 
ash.p2 p2, 
ash.p3 p3, 
o.object_name object, 
o.object_type otype, 
CURRENT_FILE# filen, 
CURRENT_BLOCK# blockn, 
ash.SQL_ID waiting_sql, 
BLOCKING_SESSION blocker 
from 
v$active_session_history ash, 
all_objects o 
where 
event like 'enq: T%' 
and o.object_id (+)= ash.CURRENT_OBJ# 
/ 
Meaning 
varies
33.. WWaaiittss:: eennqq TTXX 44 
Mode 4, unique key 
ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID 
----- ---------------------- --- --- ------ ---- ----- ----- --- ------ -- 
10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 
10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 
10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 
10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 
Mode 4, foreign key 
ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID 
----- ---------------------- --- --- ------ ---- ----- ----- --- ------ -- 
10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1 
10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1 
10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1 
Mode 4, bitmap 
ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID 
----- ---------------------- --- --- ------ ---- ----- ----- --- ------ -- 
10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144 
10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144 
10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144 
10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144
4. Top 
• Procedure 
– ash_top_procedure.sql 
• Session 
– ash_top_session.sql - wait, I/O and CPU time 
• SQL 
– ash_top_sql.sql - wait, I/O and CPU time 
– ash_top_sql_w_top_obj.sql - with top OBJ per SQL
4. Top: PROCEDURE ash_top_procedure.sql 
1100..22..00..33 AASSHH aaddddeedd 
PLSQL_ENTRY_OBJECT_ID 
PLSQL_ENTRY_SUBPROGRAM_ID 
PLSQL_OBJECT_ID 
PLSQL_SUBPROGRAM_ID 
AALLLL__PPRROOCCEEDDUURREESS vviieeww 
oobbjjeecctt__iidd == ppllssqqll__oobbjjeecctt__iidd 
ssuubbpprrooggrraamm__iidd == ppllssqqll__ssuubbpprrooggrraamm__iidd 
10/04/14 100
4. Top: PROCEDURE 
ash_top_procedure.sql 
COUNT(*) SQL_ID calling_code 
--------- ------------- ------------------------------------------ 
2 1xxksrhwtz3zf ORDERENTRY.NEWORDER => DBMS_RANDOM.VALUE 
2 1xxksrhwtz3zf ORDERENTRY.NEWORDER => DBMS_LOCK.SLEEP 
13 1xxksrhwtz3zf ORDERENTRY.NEWORDER 
16 0bzhqhhj9mpaa ORDERENTRY.NEWCUSTOMER 
45 41zu158rqf4kf ORDERENTRY.BROWSEANDUPDATEORDERS
4. Top: SESSION 
ash_top_session.sql 
STATUS SID NAME PROGRAM CPU WAITING IO TOTAL 
------------ ----- ------------ ------------------------- ----- ------- ----- ------ 
DISCONNECTED 54 SYS oracle@source (J000) 1227 540 152 1919 
DISCONNECTED 57 SYS oracle@source (J001) 725 160 18 903 
DISCONNECTED 71 SYS sqlplus@source (TNS V1-V3 535 60 36 631 
DISCONNECTED 67 SYSTEM LAB128.exe 187 182 148 517 
CONNECTED 10 SYS oracle@source (DBW0) 267 171 0 438 
CONNECTED 11 SYS oracle@source (LGWR) 10 357 0 367 
DISCONNECTED 44 SYS sqlplus@source (TNS V1-V3 103 158 15 276 
CONNECTED 53 SYSTEM JDBC Thin Client 129 33 0 162 
CONNECTED 36 SYSMAN OMS 6 114 0 120
4. Top: SQL 
ash_top_sql.sql 
SQL_ID PLAN_HASH TYPE CPU WAIT IO TOTAL 
------------- ---------- ---------- ------- ----- ------- ------ 
fdtr6ds1nxm5r 1269593971 SELECT 9345 9 84277 93631 
5aa7r665a07n6 3761618565 SELECT 82040 6 850 82896 
2x8kgb0s9q1zh 0 PL/SQL EXE 75967 1575 1186 78728 
4qraawku9303p 2256852101 SELECT 46995 45 3196 50236 
3h7agx5ndadrf 1006614515 SELECT 2068 1 24914 26983 
8p2cyq3gdgau5 2108428761 SELECT 22345 489 313 23147 
7vpqr5zhjm08v 4089415459 SELECT 422 0 19655 20077 
7sf51jrzq6y3c 485652470 INSERT 1727 1418 15471 18616 
6cy7mc2kj0u4z 3041431021 SELECT 14272 0 0 14272
4. Top: SQL 
ash_top_sql_w_top_obj.sql 
SQL_ID SQLPLANHASH AUD_ACT CPU WAIT IO TOTAL PCT_IO TOP_OBJ 
------------- ----------- ------- ---- ----- ---- ------- ------- -------------- 
dr1fpksws4nv9 3458999899 SELECT 3791 0 0 3791 
dc9fkz2t3b9p8 1909389838 SELECT 3685 0 5 3690 60 PS_F_ABS_EXPTN_CAL 
50spnwj8tdnnh 2849751558 SELECT 1981 57 0 2038 
fuzcbdt08xjcd 2618832091 SELECT 0 1864 0 1864 
30hzp85f3qtxj 3802366046 SELECT 568 0 921 1489 100 PS_TAX_BALANCE 
c61wk6d7ssxxc 702141750 SELECT 117 6 1364 1487 98 PS_PAY_DEDUCTION 
c3y6kdm1uzkb7 2395607145 SELECT 39 0 1375 1414 87 PS_PAY_CHECK 
6wsy8rpd0bw26 252818247 SELECT 1363 0 14 1377 64 PS_F_TIALAST_HIST
5. I/O – lots you can do 
I/O by 
•SQL 
•Object 
•File & Table Space 
•Parallel Query master and slaves 
•By type of I/O 
– Db file sequential read 
– Db file scattered read 
– Direct path read 
– Direct path read temp 
– Direct path write 
– Direct path write temp
5. I/O : iosql.sql 
I/O by SQL and top Objects for that sql 
AAS SQL_ID % OBJ TABLESPACE 
----- ------------- --- --------------- ---------- 
.18 0yas01u2p9ch4 6 ITEM_PRODUCT_IX SOEINDEX 
6 ORDER_ITEMS_UK SOEINDEX 
88 ITEM_ORDER_IX SOEINDEX 
.32 6v6gm0fd1rgrz 6 WAIT_OBJECTS SYSTEM 
94 UNDO UNDOTBS1
iosql.sql select 
sum(cnt) over ( partition by io.sql_id order by sql_id ) tcnt, 
io.sql_id, io.cnt cnt, io.aas aas, io.objn objn, io.obj obj, io.p1 p1, 
f.tablespace_name tablespace_name 
from 
( 
select 
sql_id, 
count(*) cnt, 
round(count(*)/(&v_minutes*60),2) aas, 
CURRENT_OBJ# objn, 
nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj, 
o.object_type otype, 
ash.p1 
from v$active_session_history ash 
,all_objects o 
where ( event like 'db file s%' or event like 'direct%' ) 
and o.object_id (+)= ash.CURRENT_OBJ# 
and sample_time > sysdate - &v_minutes/(60*24) 
group by 
CURRENT_OBJ#,o.object_name ,o.object_type , ash.p1, sql_id 
) io, 
dba_data_files f 
where 
f.file_id = io.p1 
Order by tcnt, io.sql_id, io.cnt 
/
Extra : Latency 
Can’t get latency from: avg(TIME_WAITED) 
• latency_waitclassmetric.sql 
– 60 seconds avg by WAIT_CLASS 
– V$WAITCLASSMETRIC 
• latency_eventmetric.sql 
– 60 seconds avg by EVENT 
– V$EVENTMETRIC 
• latency_system_event.sql 
– Hour avg by EVENT 
– DBA_HIST_SYSTEM_EVENT
Latency: Last 60 seconds for I/O waitclass 
latency_waitclassmetric.sql 
AVG_IO_MS 
---------- 
2.032 
select 
10*time_waited/nullif(wait_count,0) avg_io_ms 
-- convert centi-seconds to milliseconds 
from v$waitclassmetric m 
where wait_class_id= 1740759767 -- User I/O 
/
latency: latency_eventmetric.sql 
Last 60 seconds 
NAME TIME_WAITED WAIT_COUNT AVGMS 
------------------------- ----------- ---------- ---------- 
log file parallel write 3.856 12 3.213 
log file sync 2.809 6 4.682 
db file sequential read 0 0 
db file scattered read 0 0 
direct path read 0 0 
direct path read temp 0 0 
direct path write 0 0 
direct path write temp 0 0
latency: last 60 seconds 
select -- m.intsize_csec, 
latency_eventmetric.sql 
n.name , 
round(m.time_waited,3) time_waited, 
m.wait_count, 
round(10*m.time_waited/nullif(m.wait_count,0),3) avgms 
from v$eventmetric m, 
v$event_name n 
where m.event_id=n.event_id 
and n.name in ( 
'db file sequential read', 
'db file scattered read', 
'direct path read', 
'direct path read temp', 
'direct path write', 
'direct path write temp', 
'log file sync', 
'log file parallel write' 
v$event_metric only had 
event ids  
Join to v$event_name 
I/O Events
Latency: each hour 
latency_system_event.sql 
Input event name 
BTIME AVG_MS 
------------------------ ---------- 
01-MAY-13 23:00 .199 
02-MAY-13 00:00 .023 
02-MAY-13 01:00 .031 
02-MAY-13 02:00 .006 
02-MAY-13 03:00 .017 
02-MAY-13 04:00 .015 
02-MAY-13 05:00 .013 
02-MAY-13 06:00 .019 
02-MAY-13 07:00 .017 
DBA_HIST_SYSTEM_EVENT 
DBA_HIST_SNAPSHOT
Oramon.sh
oramon.sh
Oramon.sh 
Usage: oramon.sh [username] [password] [host] [sid] <port=1521> <runtime=3600> 
Connected, starting collect at Wed Dec 5 14:59:24 EST 2012 
starting stats collecting 
single block logfile write multi block direct read direct read temp direct write temp 
ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s 
3.53 .72 16.06 .17 4.64 .00 115.37 3.73 .00 0 
1.66 487.33 2.66 138.50 4.84 33.00 .00 .00 0 
1.71 670.20 3.14 195.00 5.96 42.00 .00 .00 0 
2.19 502.27 4.61 136.82 10.74 27.00 .00 .00 0 
1.38 571.17 2.54 177.67 4.50 20.00 .00 .00 0 
single block logfile write multi block direct read direct read temp direct write temp 
ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s 
3.22 526.36 4.79 135.55 .00 .00 .00 0 
2.37 657.20 3.27 192.00 .00 .00 .00 0 
1.32 591.17 2.46 187.83 .00 .00 .00 0 
2.23 668.60 3.09 204.20 .00 .00 .00 .00 0 
https://github.com/khailey/oramon
Summary 
Load on database = AAS = DB Time/elapsed ~ = count(*)/elapsed 
Select count(*)/{time period in seconds} AAS 
from ASH 
where {criteria} 
and {time period}; 
Custom queries can give detailed info on 
• SQL excution, max, min 
• Top SQL, Session, Procedure, Object 
• IO by SQL, Object, Tablespace 
• Detailed wait analysis – BBW, Enqueues etc 
https://github.com/khailey/ashmasters
END
1111..11gg AASSHH eexxttrraass 
SSQQLL EEllaappsseedd 
SQL_EXEC_ID 
SQL_EXEC_START 
OOppeerraattiioonn bbiitt vveeccttoorr –– nnoonn ttiimmeedd ooppss 
IN_CONNECTION_MGMT 
IN_PARSE 
IN_HARD_PARSE 
IN_SQL_EXECUTION 
IN_PLSQL_EXECUTION 
IN_PLSQL_RPC 
IN_PLSQL_COMPILATION 
IN_JAVA_EXECUTION 
IN_BIND 
IN_CURSOR_CLOSE 
SQL_PLAN_LINE_ID 
SQL_PLAN_OPERATION 
SQL_PLAN_OPTIONS 
EETTCC 
CURRENT_ROW# 
EVENT# 
QC_SESSION_SERIAL# 
CONSUMER_GROUP_ID 
FLAGS 
SSQQLL RRooww SSoouurrccee 
WWhhiicchh iinnssttaannccee rreeqquueesstteedd bblloocckk?? 
REMOTE_INSTANCE# 
RReeccuurrssiivvee SSQQLL 
TOP_LEVEL_SQL_ID 
TOP_LEVEL_SQL_OPCODE
1111..22gg AASSHH eexxttrraass 
SSttaattiissttiiccss 
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_ALLOCATE 
Copyright 2006 Kyle Hailey
AASSHH AAccrroossss VVeerrssiioonnss 
1100..11 1100..22 1100..22..00..33 1111..11 1111..22 
When 
Who 
SQL 
ASH 
instrumentation 
is exploding 
across the 
versions 
Waits 
Statistics 
Blocker
I/O Sizes 
• ash_io_sizes.sql - I/O sizes from ASH
I/O 
• io.sql 
• io_timestamps.sql 
• ioag.sql 
• ioag_orig.sql 
• iodfpr.sql 
• ionoobj.sql 
• ionosql.sql 
• ioobj.sql 
• ioobjdec.sql 
• iop.sql 
• iosql.sql 
• iotbs.sql 
• iotbs1.sql 
• iotx.sql 
• jb_sql.txt
io.sql - basic I/O 
EVENT P1 P2 P3 OBJ OTYPE SQL_ID 
--------------- ----- ---- -- -------------------- ---------- ------------- 
db file sequent 1 22377 1 -1 7wt7phk4xns75 
db file sequent 2 75849 1 -1 13fnb572x6z9j 
db file sequent 2 78039 1 -1 8tfvwyvfm5cjn 
db file sequent 1 91095 1 -1 d15cdr0zt3vtp 
db file sequent 2 321005 1 WRH$_ACTIVE_SESSION_ TABLE PART 25a6sjj8zdbr7 
db file scatter 2 331679 3 WRH$_ACTIVE_SESSION_ TABLE PART 25a6sjj8zdbr7 
Select substr(event,0,15) event, 
ash.p1, 
ash.p2, 
ash.p3 p3, 
nvl(o.object_name,CURRENT_OBJ#) obj, 
o.object_type otype, 
--CURRENT_FILE# filen, 
--CURRENT_BLOCK# blockn, 
ash.SQL_ID 
from v$active_session_history ash, 
all_objects o 
where event like 'db file s%' 
and o.object_id (+)= ash.CURRENT_OBJ# 
and sample_time > sysdate - &minutes/(60*24) 
Order by sample_time 
/
io_pqo.sql 
select 
ash.SQL_ID, 
QC_SESSION_ID qsid, 
count(*) cnt, 
count (distinct session_id) deg, 
nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, 
o.object_type otype, 
decode(session_state, 'WAITING',event,'CPU') event 
from v$active_session_history ash, 
all_objects o 
where o.object_id (+)= ash.CURRENT_OBJ# 
and qc_session_id is not null 
group by qc_session_id, sql_id, o.object_name, 
o.object_type, CURRENT_OBJ#, event, session_state 
Order by qc_session_id, sql_id 
SSQQLL__IIDD QQSSIIDD CCNNTT DDEEGG OOBBJJ OOTTYYPPEE EEVVEENNTT 
-------------------------- -------- -------- ------ ------------------------ ---------- ---------------------------------------------- 
77pp33jjtt7755pphhuubb22dd 114444 338866 44 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE PPXX DDeeqq CCrreeddiitt:: sseenndd bbllkkdd 
114444 44 33 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE PPXX qqrreeff llaattcchh 
114444 3377 11 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE ddbb ffiillee sseeqquueennttiiaall rreeaadd 
114444 33 22 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE ddiirreecctt ppaatthh rreeaadd 
114444 7700 11 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE CCPPUU 
114444 2211 44 00 PPXX DDeeqq CCrreeddiitt:: sseenndd bbllkkdd 
114444 1122 44 00 ddbb ffiillee sseeqquueennttiiaall rreeaadd
io_timestamps.sql: time range for I/O by Obj 
CNT DELTA MNT MXT EVENT OBJN OTYPE 
--- ------- ----------------- ----------------- --------------- ------------------------- --------------- 
15 .0382 04/13/05 18:23:16 04/13/05 19:18:15 direct path wri 232 I_PROCEDUREINFO1 INDEX 
15 .0143 04/13/05 18:24:50 04/13/05 18:45:27 direct path wri 222 PROCEDUREINFO$ TABLE 
23 .0117 04/13/05 18:25:43 04/13/05 18:42:36 db file scatter 6339 WRH$_SQL_PLAN TABLE 
26 .0302 04/13/05 18:32:28 04/13/05 19:15:57 direct path wri 0 
59 .1930 04/13/05 18:22:43 04/13/05 23:00:35 db file sequent -1 
select 
count(*) cnt, 
cast(max(sample_time) as date) - cast(min(sample_time) as date) delta, 
to_char(cast(min(sample_time) as date),'DD/YY/MM HH24:mi:ss') mnt, 
to_char(cast(max(sample_time) as date),'DD/YY/MM HH24:mi:ss') mxt, 
substr(event,0,15) event, 
CURRENT_OBJ#||' '||o.object_name objn, 
o.object_type otype 
from v$active_session_history ash, 
all_objects o 
where ( event like 'db file s%' or event like 'direct%' ) 
and o.object_id (+)= ash.CURRENT_OBJ# 
--and sample_time > sysdate - &minutes/(60*24) 
group by 
substr(event,0,15) , 
CURRENT_OBJ#, o.object_name , 
o.object_type 
Order by cnt 
/
ioag.sql - I/O by File# an Tablespace 
CNT AAS EVENT OBJ P1 TABLESPACE_NAME 
---- --- --------------- -------------------- ----- --------------- 
10 0 db file sequent 0 2 SYSAUX 
12 0 db file sequent WRH$_SEG_STAT 2 SYSAUX 
13 0 db file scatter WRH$_ACTIVE_SESSION_ 2 SYSAUX 
14 0 db file scatter 77259 7 AWR 
22 0 db file sequent 0 1 SYSTEM 
23 0 db file scatter WRH$_SQL_PLAN 2 SYSAUX
ioag.sql - I/O tablespace 
select &minutes f_minutes from dual; 
select 
io.cnt cnt, 
io.aas aas, 
io.event event, 
substr(io.obj,1,20) obj, 
io.p1 p1, 
f.tablespace_name tablespace_name 
from 
( 
select 
count(*) cnt, 
round(count(*)/(&v_minutes*60),2) aas, 
substr(event,0,15) event, 
nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj, 
ash.p1, 
o.object_type otype 
from v$active_session_history ash, 
all_objects o 
where ( event like 'db file s%' or event like 'direct%' ) 
and o.object_id (+)= ash.CURRENT_OBJ# 
and sample_time > sysdate - &v_minutes/(60*24) 
group by 
substr(event,0,15) , 
CURRENT_OBJ#, o.object_name , 
o.object_type , 
ash.p1 
) io, 
dba_data_files f 
where 
f.file_id = io.p1 
Order by io.cnt 
/
ioag_orig.sql 
CNT AAS OBJN OTYPE 
--- --- --------------------------- --------------- 
13 0 77448 WRH$_ACTIVE_SESSION_HI TABLE PARTITION 
15 0 222 PROCEDUREINFO$ TABLE 
23 0 6339 WRH$_SQL_PLAN TABLE 
30 0 0 
34 0 232 I_PROCEDUREINFO1 INDEX 
37 0 -1 
select cnt, 
--event, 
round(cnt/nullif((( 
to_date(beg,'DD/MM/YY HH24:MI:SS')- 
to_date(end,'DD/MM/YY HH24:MI:SS'))* 
24*60*60),0) 
,2) aas, 
objn, 
otype 
from ( 
select 
count(*) cnt, 
to_char(nvl(min(sample_time),sysdate), 
'DD/MM/YY HH24:MI:SS') end, 
to_char(nvl(max(sample_time),sysdate), 
'DD/MM/YY HH24:MI:SS') beg, 
substr(event,0,15) event, 
CURRENT_OBJ#||' '||o.object_name objn, 
o.object_type otype 
from v$active_session_history ash, 
all_objects o 
where ( event like 'db file s%' or event like 'direct% ) 
and o.object_id (+)= ash.CURRENT_OBJ# 
and sample_time > sysdate - &minutes/(60*24) 
group by 
substr(event,0,15) , 
CURRENT_OBJ#, o.object_name , 
o.object_type 
) 
Order by cnt 
/
iodfpr.sql – db file parallel read 
CNT P1 P2 P3 OBJ OTYPE SQL_ID 
--- --- ---- ------------------------- --------- ------------ 
1 1 127 127 WRH$_SQL_PLAN TABLE 8jk220sm5y171 
1 1 43 43 WRH$_PARAMETER_PK INDEX PAR 03u0y15q547qq 
1 1 127 127 WRH$_SQL_PLAN_PK INDEX bvvzxsyxxbnkp 
1 1 9 9 WRH$_ROWCACHE_SUMMAR INDEX PAR 2vvqz21zckj64 
1 1 113 113 WRH$_LATCH_MISSES_SU INDEX PAR 5c3gr4vusmgcn 
1 1 117 117 WRH$_SQL_PLAN TABLE a3rgayp753z59 
Select count(*), 
ash.p1, 
ash.p2, 
to_char(ash.p3) p3 , 
nvl(o.object_name,CURRENT_OBJ#) obj, 
o.object_type otype, 
ash.SQL_ID 
from v$active_session_history ash, 
all_objects o 
where event like 'db file p%' 
and o.object_id (+)= ash.CURRENT_OBJ# 
and sample_time > sysdate - &minutes/(60*24) 
group by 
ash.p1, ash.p2, ash.p3 , 
o.object_name, 
CURRENT_OBJ#, 
o.object_type , 
ash.SQL_ID 
order by count(*) 
/
ionoobj.sql – I/O with no Object ID 
COUNT(*) P1 P2 
------- ----- ---------- 
1 2 11522 
1 1 24517 
1 1 18536 
1 201 12422 
1 201 11264 
2 201 11780 
2 201 12416 
2 201 11776 
select 
count(*), 
ash.p1, 
ash.p2 
from v$active_session_history ash 
where ( event like 'db file s%' or event like 'direct%' ) 
and sample_time > sysdate - &minutes/(60*24) 
and session_state='WAITING' 
and ( current_obj# = -1 or current_obj#=0 ) 
group by 
ash.p1, 
ash.p2 
Order by count(*) 
/
ionosql.sql - I/O with no SQL_ID 
CNT USERNAME OBJ 
---------- --------------- -------------------- 
1 SYS 0 
select 
count(*) cnt 
,nvl(u.username,ash.user_id) username 
,nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj 
from v$active_session_history ash, 
all_objects o, 
dba_users u 
where ( event like 'db file s%' or event like 'direct%' ) 
and sample_time > sysdate - &minutes/(60*24) 
and session_state='WAITING' 
and (sql_id is null or sql_id ='') 
and o.object_id (+)= ash.CURRENT_OBJ# 
and u.user_id (+) = ash.user_id 
group by 
ash.current_obj# 
,o.object_name 
,u.username 
,ash.user_id 
Order by count(*) 
/
ioobj.sql - I/O by Object 
CNT AAS OBJN OTYPE 
---------- -------------------------- --------------- 
15 0 222 PROCEDUREINFO$ TABLE 
17 0 77448 WRH$_ACTIVE_SESSION TABLE PARTITION 
24 0 6339 WRH$_SQL_PLAN TABLE 
32 0 0 
36 0 232 I_PROCEDUREINFO1 INDEX 
40 0 -1 
select &minutes f_minutes from dual; 
select 
count(*) cnt, 
round(count(*)/(&v_minutes*60),2) aas, 
CURRENT_OBJ#||' '||o.object_name objn, 
o.object_type otype 
from v$active_session_history ash, 
all_objects o 
where ( event like 'db file s%' or event like 'direct%' ) 
and o.object_id (+)= ash.CURRENT_OBJ# 
and sample_time > sysdate - &v_minutes/(60*24) 
and session_state='WAITING' 
group by 
CURRENT_OBJ#, o.object_name , 
o.object_type 
Order by count(*) 
/
ioobjdec.sql - myextents 
x drop table myextents; 
l 
create table myextents as select * from dba_extents; 
l 
select 
count(*), 
ext.owner, 
ext.segment_name, 
ext.partition_name, 
ext.segment_type 
from v$active_session_history ash, 
myextents ext 
where ( event like 'db file s%' or event like 'direct%' ) 
and sample_time > sysdate - &minutes/(60*24) 
and session_state='WAITING' 
and ( current_obj# = -1 or current_obj#=0 ) 
and ext.file_id(+)=ash.p1 and 
ash.p2 between ext.block_id and ext.block_id + ext.blocks 
group by 
ext.owner, 
ext.segment_name, 
ext.partition_name, 
ext.segment_type 
Order by count(*) 
/
iop.sql – I/O P1,P2,P3 
NAME P1 P2 P3 
----------------------- ------------ --------- ---------- 
read by other session file# block# class# 
db file sequential read file# block# blocks 
db file scattered read file# block# blocks 
db file parallel read files blocks requests 
direct path read file number first dba block cnt 
direct path read temp file number first dba block cnt 
direct path write file number first dba block cnt 
direct path write temp file number first dba block cnt 
select name, 
parameter1 p1, 
parameter2 p2, 
parameter3 p3 
from v$event_name 
where name in ( 
'db file sequential read', 
'db file scattered read', 
'db file parallel read', 
'read by other session', 
'direct path read', 
'direct path write', 
'direct path read temp', 
'direct path write temp', 
'direct path write (lob)' 
);
iosql.sql – I/O by SQL_ID breakdown OBJ 
TCNT SQL_ID CNT AAS OBJN OBJ P1 TABLESPACE_NAME 
----- ---------- ---- ---- --- -------------------- -- --------------- 
11 3zqmt52j08cby 2 0 -1 0 7 AWR 
2 0 521 SYS_LOB0000000520C00 1 SYSTEM 
4 0 -1 0 1 SYSTEM 
12 a3rgayp753z59 1 0 6342 WRH$_SQL_PLAN_PK 2 SYSAUX 
11 0 6339 WRH$_SQL_PLAN 2 SYSAUX 
14 52tyrgvbph5fc 14 077259 77259 7 AWR
iosql_aas.sql – I/O by SQL_ID break by OBJ 
AAS SQL_ID CNT PCT OBJ SUB_OBJ OTYPE EVENT F# TBSP CONTENTS 
---- ------------- --- ---- ------------------ -------- ---------- ---------- -- ------ -------- 
.000 a3rgayp753z59 1 8 WRH$_SQL_PLAN_PK INDEX sequentia 2 SYSAUX PERMANENT 
.000 a3rgayp753z59 11 92 WRH$_SQL_PLAN TABLE scattered 2 SYSAUX PERMANENT 
.000 2hgxq2u3v0qjc 13 100 WRH$_FILESTATXS_PK WRH$_FILES INDEX PART sequentia 2 SYSAUX PERMANENT 
.000 2whm2vvjb98k7 6 22 scattered 2 SYSAUX PERMANENT 
21 78 sequentia 2 SYSAUX PERMANENT
iosql.sql 
TCNT SQL_ID CNT AAS OBJN OBJ P1 TABLESPACE_NAME 
----- ---------- ---- ---- --- -------------------- -- --------------- 
11 3zqmt52j08cby 2 0 -1 0 7 AWR 
2 0 521 SYS_LOB0000000520C00 1 SYSTEM 
4 0 -1 0 1 SYSTEM 
12 a3rgayp753z59 1 0 6342 WRH$_SQL_PLAN_PK 2 SYSAUX 
11 0 6339 WRH$_SQL_PLAN 2 SYSAUX 
14 52tyrgvbph5fc 14 077259 77259 7 AWR 
select 
sum(cnt) over ( partition by io.sql_id order by sql_id ) tcnt, 
io.sql_id, io.cnt cnt, io.aas aas, io.objn objn, io.obj obj, io.p1 p1, 
f.tablespace_name tablespace_name 
from 
( 
select 
sql_id, 
count(*) cnt, 
round(count(*)/(&v_minutes*60),2) aas, 
CURRENT_OBJ# objn, 
nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj,
iotbs1.sql 
CNT EVENT TABLESPACE_NAME 
------- --------------- --------------- 
13 direct path wri AWR 
18 db file sequent AWR 
38 db file scatter AWR 
46 db file sequent SYSTEM 
58 db file scatter SYSAUX 
83 db file sequent SYSAUX 
select 
tf.cnt, 
tf.event, 
f.tablespace_name 
from ( 
select 
count(*) cnt, 
substr(event,0,15) event, 
ash.p1 p1 
from v$active_session_history ash 
where ( event like 'db file s%' or event like 'direct%' ) 
and sample_time > sysdate - &minutes/(60*24) 
group by 
substr(event,0,15) , 
ash.p1 
) tf, 
dba_data_files f 
where 
f.file_id = tf.p1 
Order by tf.cnt 
/
iotx.sql 
SQL_ID XID 
------------- ---------------- 
fty6ptn572tt8 
fzxxhn9yjhtqm 0900030011070000 
g3tvrzsb8rb7j 
g48azr9sj7ud2 
g7rjqg0t81tv6 05000E006E060000 
gh2hf1fqppaxr 
gq841w157yvsp 
Select 
ash.sql_id 
,ash.xid 
from v$active_session_history ash 
where ( event like 'db file s%' or event like 'direct%' ) 
and sample_time > sysdate - &minutes/(60*24) 
and session_state='WAITING’ 
order by sql_id, xid 
/
io_seq.sql 
x
io_scat.sql 
EVENT P3 OBJN OTYPE FILEN BLOCKN SQL_ID 
----------------------- --- -------------------- ---------- ------ ------- ------------- 
db file scattered read 5 5904 WRI$_ADV_USAGE TABLE 2 3691 7aum6ufgy2xjq 
db file scattered read 31 77403 WRH$_LATCH_PK INDEX PART 2 228293 1zkmvr5gjshqk 
db file scattered read 8 78168 WRH$_SQLSTAT TABLE PART 2 360352 040bmjsqca000 
db file scattered read 128 -1 0 0 2whm2vvjb98k7 
db file scattered read 124 -1 0 0 2whm2vvjb98k7 
db file scattered read 128 -1 0 0 2whm2vvjb98k7 
db file scattered read 4 -1 0 0 2whm2vvjb98k7 
db file scattered read 6 -1 0 0 2whm2vvjb98k7 
db file scattered read 128 -1 0 0 2whm2vvjb98k7 
Select event, 
ash.p3, 
CURRENT_OBJ#||' '||o.object_name objn, 
o.object_type otype, 
CURRENT_FILE# filen, 
CURRENT_BLOCK# blockn, 
ash.SQL_ID 
from v$active_session_history ash, 
all_objects o 
where event like 'db file scattered read' 
and o.object_id (+)= ash.CURRENT_OBJ# 
Order by sample_time;
jb_sql.txt 
x
cpu_consumed_verses_cpuwait.sql 
QL> @cpu_consumed_verses_cpuwait.sql 
CPU_TOTAL CPU_OS CPU_ORA CPU_ORA_WAIT COMMIT READIO WAIT 
---------- ---------- ---------- ------------ ---------- ---------- ---------- 
.088 .086 .002 0 0 0 .002
Exporting AWR 
http://gavinsoorma.com/2009/07/25/exporting-and-importing-awr-snapshot-data/ 
SQL> CREATE DIRECTORY AWR_DATA AS ‘/u01/oracle/’; 
SQL> @?/rdbms/admin/awrextr.sql 
Enter value for directory_name: AWR_DATA 
Using the dump directory: AWR_DATA 
Enter value for file_name: awrexp
Importing AWR : create tablespace 
create BIGFILE tablespace AWR 
datafile '/home/oracle/oradata/${ORACLE_SID}/awr_01.dbf' 
size 1G 
NOLOGGING ONLINE 
PERMANENT 
EXTENT MANAGEMENT LOCAL 
AUTOALLOCATE 
SEGMENT SPACE MANAGEMENT AUTO ; 
alter tablespace AWR autoextend on 
next 200m maxsize unlimited;
Importing AWR: drop/recreate user 
-- create tablespace AWR datafile ’&DATAFILE' size 200M; 
-- drop directory AWR_DMP; 
create directory AWR_DMP AS '&AWR_DMP_LOCATION’; 
-- drop every time 
drop user awr_stage cascade; 
create user awr_stage 
identified by awr_stage 
default tablespace awr 
temporary tablespace temp; 
grant connect to awr_stage; 
alter user awr_stage quota unlimited on awr; 
alter user awr_stage temporary tablespace temp;
Importing AWR : import dmp file 
-- Import dump file into stage 
begin 
dbms_swrf_internal.awr_load( 
schname => 'AWR_STAGE', 
dmpfile => '&DMP_FILE', -- file w/o .dmp 
dmpdir => 'AWR_DMP'); 
end; 
/ 
-- change dbid, give it a new # 
def dbid=&DBID; 
@awr_change_dbid
Importing AWR : move from Stage, change DBID 
-- move from stage to SYSAUX 
def schema_name='AWR_STAGE' 
select '&schema_name' from dual; 
variable schname varchar2(30); 
begin 
:schname := '&schema_name'; 
dbms_swrf_internal.move_to_awr(schname => :schname); 
end; 
/ 
-- check new DBID 
col host_name for a30 
select distinct dbid, version, db_name, instance_name, host_name from 
dba_hist_database_instance;
• Wait Analysis 
• ash_bbw.sql - buffer busy 
• ash_enq.sql - enqueue 
• Load Charts 
• V$ACTIVE_SESSION_HISTORY 
• ash_graph_ash.sql – basic 
• DBA_HIST_ACTIVE_SESS_HISTORY 
• ash_graph_ash_histash.sql – 
• ash_graph_histash_by_dbid.sql - input DBID 
• ash_graph_histash_by_dbid_program.sql - input DBID and PROGRAM 
• ash_graph_histash_by_dbid_sqlid.sql - input DBID and a SQL_ID 
• SQL Elapsed 
• ash_sql_elapsed.sql - longest running SQL 
• ash_sql_elapsed_hist.sql – “” with histogram of execution times 
• ash_sql_elapsed_hist_longestid.sql - “” execution id of longest running query 
• Top 
• ash_top_procedure.sql 
• ash_top_session.sql - wait, I/O and CPU time 
• ash_top_sql.sql - wait, I/O and CPU time 
• ash_top_sql_w_top_obj.sql -I/O and CPU time, include top object for I/O waits 
• Latency 
• latency_eventmetric.sql - wait event latency from V$EVENTMETRIC, ie last 60 seconds 
• latency_system_event.sql - wait event latency from DBA_HIST_SYSTEM_EVENT 
• latency_waitclassmetric.sql - User I/O latency from V$WAITCLASSMETRIC, ie over last 60 seconds 
• I/O Sizes 
• ash_io_sizes.sql - I/O sizes from ASH
Cool stuff 
• Querying across RAC nodes 
• Extrapolating wait times from wait counts
aacctt..ssqqll-- aaccttiivviittyy 
@act 
Analysis Begin Time : 2007-07-24 11:04:48 
Analysis End Time : 2007-07-24 11:19:45 
Start time, mins ago: 15 
Request Duration : 15 
Collections : 528 
Data Values : 3327 
Elapsed Time: 15 mins 
@act 
Analysis Begin Time : 2007-07-24 11:04:48 
Analysis End Time : 2007-07-24 11:19:45 
Start time, mins ago: 15 
Request Duration : 15 
Collections : 528 
Data Values : 3327 
Elapsed Time: 15 mins 
WAIT_EVENT CNT % Active Ave_Act_Sess 
-------------------------------------- ---------- ------------ 
latch free 10 .3 .02 
log buffer space 13 .39 .02 
buffer busy waits 14 .42 .03 
db file scattered read 15 .45 .03 
library cache pin 78 2.34 .15 
log file sync 213 6.40 .40 
ON CPU 726 21.82 1.38 
enqueue 855 25.70 1.62 
db file sequential read 1399 42.05 2.65 
WAIT_EVENT CNT % Active Ave_Act_Sess 
-------------------------------------- ---------- ------------ 
latch free 10 .3 .02 
log buffer space 13 .39 .02 
buffer busy waits 14 .42 .03 
db file scattered read 15 .45 .03 
library cache pin 78 2.34 .15 
log file sync 213 6.40 .40 
ON CPU 726 21.82 1.38 
enqueue 855 25.70 1.62 
db file sequential read 1399 42.05 2.65 
------------ 
------------ 
sum 6.30 
sum 6.30
 1990 Oracle 
– 90 support 
– 92 Ported v6 
– 93 France 
– 95 Benchmarking 
– 98 ST Real World Performance 
Who is Kyle Hailey 
 2000 Dot.Com 
 2001 Quest 
 2002 Oracle OEM 10g Success! 
First successful OEM design
 1990 Oracle 
– 90 support 
– 92 Ported v6 
– 93 France 
– 95 Benchmarking 
– 98 ST Real World Performance 
 2000 Dot.Com 
 2001 Quest 
 2002 Oracle OEM 10g 
 2005 Embarcadero 
– DB Optimizer 
Who is Kyle Hailey
Who is Kyle Hailey 
• 1990 Oracle 
 90 support 
 92 Ported v6 
 93 France 
 95 Benchmarking 
 98 ST Real World Performance 
• 2000 Dot.Com 
• 2001 Quest 
• 2002 Oracle OEM 10g 
• 2005 Embarcadero 
 DB Optimizer 
• Delphix 
When not being a Geek 
- Have a little 4 year old boy who takes up all my time … 
and now a 2 week old !

Weitere ähnliche Inhalte

Was ist angesagt?

Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007John Beresniewicz
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linuxKyle Hailey
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Kristofferson A
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015Yury Velikanov
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014John Beresniewicz
 
Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuningAiougVizagChapter
 
VirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWRVirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWRKristofferson A
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And Whatudaymoogala
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTanel Poder
 
Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013John Beresniewicz
 
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and VisualizationWhitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and VisualizationKristofferson A
 
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
Mark Farnam  : Minimizing the Concurrency Footprint of TransactionsMark Farnam  : Minimizing the Concurrency Footprint of Transactions
Mark Farnam : Minimizing the Concurrency Footprint of TransactionsKyle Hailey
 
Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?Kristofferson A
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data miningYury Velikanov
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTanel Poder
 

Was ist angesagt? (20)

Ash Outliers UKOUG2011
Ash Outliers UKOUG2011Ash Outliers UKOUG2011
Ash Outliers UKOUG2011
 
Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007Average Active Sessions RMOUG2007
Average Active Sessions RMOUG2007
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linux
 
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
Hotsos 2011: Mining the AWR repository for Capacity Planning, Visualization, ...
 
Using Statspack and AWR for Memory Monitoring and Tuning
Using Statspack and AWR for Memory Monitoring and TuningUsing Statspack and AWR for Memory Monitoring and Tuning
Using Statspack and AWR for Memory Monitoring and Tuning
 
Using AWR/Statspack for Wait Analysis
Using AWR/Statspack for Wait AnalysisUsing AWR/Statspack for Wait Analysis
Using AWR/Statspack for Wait Analysis
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014
 
Awr + 12c performance tuning
Awr + 12c performance tuningAwr + 12c performance tuning
Awr + 12c performance tuning
 
VirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWRVirtaThon 2011 - Mining the AWR
VirtaThon 2011 - Mining the AWR
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
 
AWR reports-Measuring CPU
AWR reports-Measuring CPUAWR reports-Measuring CPU
AWR reports-Measuring CPU
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
 
Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013Average Active Sessions - OaktableWorld 2013
Average Active Sessions - OaktableWorld 2013
 
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and VisualizationWhitepaper: Mining the AWR repository for Capacity Planning and Visualization
Whitepaper: Mining the AWR repository for Capacity Planning and Visualization
 
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
Mark Farnam  : Minimizing the Concurrency Footprint of TransactionsMark Farnam  : Minimizing the Concurrency Footprint of Transactions
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
 
Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?Whitepaper: Where did my CPU go?
Whitepaper: Where did my CPU go?
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data mining
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 

Andere mochten auch

How to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemHow to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemCary Millsap
 
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseOaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseKyle Hailey
 
History of database monitoring
History of database monitoringHistory of database monitoring
History of database monitoringKyle Hailey
 
SQL Tuning Methodology, Kscope 2013
SQL Tuning Methodology, Kscope 2013 SQL Tuning Methodology, Kscope 2013
SQL Tuning Methodology, Kscope 2013 Kyle Hailey
 
The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®Cary Millsap
 
DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学
DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学
DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学Hiroshi Sekiguchi
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata securityKyle Hailey
 
OakTable World Sep14 clonedb
OakTable World Sep14 clonedb OakTable World Sep14 clonedb
OakTable World Sep14 clonedb Connor McDonald
 
Indexes: Structure, Splits and Free Space Management Internals
Indexes: Structure, Splits and Free Space Management InternalsIndexes: Structure, Splits and Free Space Management Internals
Indexes: Structure, Splits and Free Space Management InternalsChristian Antognini
 
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!Kyle Hailey
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...Marco Gralike
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASKyle Hailey
 
ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012Amazon Web Services
 
Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?Ludovico Caldara
 
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyOracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyPythian
 
Worst Practices in Data Warehouse Design
Worst Practices in Data Warehouse DesignWorst Practices in Data Warehouse Design
Worst Practices in Data Warehouse DesignKent Graziano
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 ToolCarlos Sierra
 
DBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs WorldDBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs WorldKellyn Pot'Vin-Gorman
 

Andere mochten auch (19)

How to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemHow to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problem
 
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseOaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
 
History of database monitoring
History of database monitoringHistory of database monitoring
History of database monitoring
 
SQL Tuning Methodology, Kscope 2013
SQL Tuning Methodology, Kscope 2013 SQL Tuning Methodology, Kscope 2013
SQL Tuning Methodology, Kscope 2013
 
The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®The Most Important Things You Should Know about Oracle®
The Most Important Things You Should Know about Oracle®
 
DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学
DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学
DB Tech Showcase 2016 - E35 - SQLチューニング総合診療所的予防医学
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata security
 
OakTable World Sep14 clonedb
OakTable World Sep14 clonedb OakTable World Sep14 clonedb
OakTable World Sep14 clonedb
 
Indexes: Structure, Splits and Free Space Management Internals
Indexes: Structure, Splits and Free Space Management InternalsIndexes: Structure, Splits and Free Space Management Internals
Indexes: Structure, Splits and Free Space Management Internals
 
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
 
OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
 
ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012
 
Data control
Data controlData control
Data control
 
Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?
 
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyOracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
 
Worst Practices in Data Warehouse Design
Worst Practices in Data Warehouse DesignWorst Practices in Data Warehouse Design
Worst Practices in Data Warehouse Design
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
 
DBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs WorldDBaaS- Database as a Service in a DBAs World
DBaaS- Database as a Service in a DBAs World
 

Ähnlich wie Oracle Open World Thursday 230 ashmasters

AWR, ADDM, ASH, Metrics and Advisors.ppt
AWR, ADDM, ASH, Metrics and Advisors.pptAWR, ADDM, ASH, Metrics and Advisors.ppt
AWR, ADDM, ASH, Metrics and Advisors.pptbugzbinny
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsJohn Kanagaraj
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuningafa reg
 
Oracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingOracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingKyle Hailey
 
UKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksUKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksKyle Hailey
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQLKyle Hailey
 
active_session_history_oracle_performance.ppt
active_session_history_oracle_performance.pptactive_session_history_oracle_performance.ppt
active_session_history_oracle_performance.pptcookie1969
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoMauro Pagano
 
Wait Events 10g
Wait Events 10gWait Events 10g
Wait Events 10gsagai
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01Karam Abuataya
 
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
 
Kyle Hailey Oracle Performance IO Waits
Kyle Hailey  Oracle Performance IO WaitsKyle Hailey  Oracle Performance IO Waits
Kyle Hailey Oracle Performance IO Waitscookie1969
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and ArchitectureSidney Chen
 
OOUG: Oracle transaction locking
OOUG: Oracle transaction lockingOOUG: Oracle transaction locking
OOUG: Oracle transaction lockingKyle Hailey
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLCommand Prompt., Inc
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 

Ähnlich wie Oracle Open World Thursday 230 ashmasters (20)

AWR, ADDM, ASH, Metrics and Advisors.ppt
AWR, ADDM, ASH, Metrics and Advisors.pptAWR, ADDM, ASH, Metrics and Advisors.ppt
AWR, ADDM, ASH, Metrics and Advisors.ppt
 
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and AdvisorsYour tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
Your tuning arsenal: AWR, ADDM, ASH, Metrics and Advisors
 
Thomas+Niewel+ +Oracletuning
Thomas+Niewel+ +OracletuningThomas+Niewel+ +Oracletuning
Thomas+Niewel+ +Oracletuning
 
Oracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 samplingOracle 10g Performance: chapter 00 sampling
Oracle 10g Performance: chapter 00 sampling
 
Using AWR for IO Subsystem Analysis
Using AWR for IO Subsystem AnalysisUsing AWR for IO Subsystem Analysis
Using AWR for IO Subsystem Analysis
 
UKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction LocksUKOUG, Oracle Transaction Locks
UKOUG, Oracle Transaction Locks
 
Direct SGA access without SQL
Direct SGA access without SQLDirect SGA access without SQL
Direct SGA access without SQL
 
active_session_history_oracle_performance.ppt
active_session_history_oracle_performance.pptactive_session_history_oracle_performance.ppt
active_session_history_oracle_performance.ppt
 
SQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tangoSQL Tuning, takes 3 to tango
SQL Tuning, takes 3 to tango
 
Wait Events 10g
Wait Events 10gWait Events 10g
Wait Events 10g
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
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
 
Kyle Hailey Oracle Performance IO Waits
Kyle Hailey  Oracle Performance IO WaitsKyle Hailey  Oracle Performance IO Waits
Kyle Hailey Oracle Performance IO Waits
 
Oracle Basics and Architecture
Oracle Basics and ArchitectureOracle Basics and Architecture
Oracle Basics and Architecture
 
OOUG: Oracle transaction locking
OOUG: Oracle transaction lockingOOUG: Oracle transaction locking
OOUG: Oracle transaction locking
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Operation outbreak
Operation outbreakOperation outbreak
Operation outbreak
 
Awr doag
Awr doagAwr doag
Awr doag
 

Mehr von Kyle Hailey

Hooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume LelargeHooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume LelargeKyle Hailey
 
Performance insights twitch
Performance insights twitchPerformance insights twitch
Performance insights twitchKyle Hailey
 
Successfully convince people with data visualization
Successfully convince people with data visualizationSuccessfully convince people with data visualization
Successfully convince people with data visualizationKyle Hailey
 
Virtual Data : Eliminating the data constraint in Application Development
Virtual Data :  Eliminating the data constraint in Application DevelopmentVirtual Data :  Eliminating the data constraint in Application Development
Virtual Data : Eliminating the data constraint in Application DevelopmentKyle Hailey
 
DBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentDBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentKyle Hailey
 
Accelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual DataAccelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual DataKyle Hailey
 
Delphix and Pure Storage partner
Delphix and Pure Storage partnerDelphix and Pure Storage partner
Delphix and Pure Storage partnerKyle Hailey
 
Martin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle GuysMartin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle GuysKyle Hailey
 
Data as a Service
Data as a Service Data as a Service
Data as a Service Kyle Hailey
 
Data Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloningData Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloning Kyle Hailey
 
BGOUG "Agile Data: revolutionizing database cloning'
BGOUG  "Agile Data: revolutionizing database cloning'BGOUG  "Agile Data: revolutionizing database cloning'
BGOUG "Agile Data: revolutionizing database cloning'Kyle Hailey
 
Denver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualizationDenver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualizationKyle Hailey
 
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Kyle Hailey
 
Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix Kyle Hailey
 
DevOps, Databases and The Phoenix Project UGF4042 from OOW14
DevOps, Databases and The Phoenix Project UGF4042 from OOW14DevOps, Databases and The Phoenix Project UGF4042 from OOW14
DevOps, Databases and The Phoenix Project UGF4042 from OOW14Kyle Hailey
 
Delphix for DBAs by Jonathan Lewis
Delphix for DBAs by Jonathan LewisDelphix for DBAs by Jonathan Lewis
Delphix for DBAs by Jonathan LewisKyle Hailey
 
Kscope 14 Presentation : Virtual Data Platform
Kscope 14 Presentation : Virtual Data PlatformKscope 14 Presentation : Virtual Data Platform
Kscope 14 Presentation : Virtual Data PlatformKyle Hailey
 
Data Virtualization: revolutionizing database cloning
Data Virtualization: revolutionizing database cloningData Virtualization: revolutionizing database cloning
Data Virtualization: revolutionizing database cloningKyle Hailey
 
Delphix and DBmaestro
Delphix and DBmaestroDelphix and DBmaestro
Delphix and DBmaestroKyle Hailey
 

Mehr von Kyle Hailey (20)

Hooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume LelargeHooks in postgresql by Guillaume Lelarge
Hooks in postgresql by Guillaume Lelarge
 
Performance insights twitch
Performance insights twitchPerformance insights twitch
Performance insights twitch
 
Successfully convince people with data visualization
Successfully convince people with data visualizationSuccessfully convince people with data visualization
Successfully convince people with data visualization
 
Virtual Data : Eliminating the data constraint in Application Development
Virtual Data :  Eliminating the data constraint in Application DevelopmentVirtual Data :  Eliminating the data constraint in Application Development
Virtual Data : Eliminating the data constraint in Application Development
 
DBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentDBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application Development
 
Accelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual DataAccelerate Develoment with VIrtual Data
Accelerate Develoment with VIrtual Data
 
Delphix and Pure Storage partner
Delphix and Pure Storage partnerDelphix and Pure Storage partner
Delphix and Pure Storage partner
 
Martin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle GuysMartin Klier : Volkswagen for Oracle Guys
Martin Klier : Volkswagen for Oracle Guys
 
What is DevOps
What is DevOpsWhat is DevOps
What is DevOps
 
Data as a Service
Data as a Service Data as a Service
Data as a Service
 
Data Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloningData Virtualization: Revolutionizing data cloning
Data Virtualization: Revolutionizing data cloning
 
BGOUG "Agile Data: revolutionizing database cloning'
BGOUG  "Agile Data: revolutionizing database cloning'BGOUG  "Agile Data: revolutionizing database cloning'
BGOUG "Agile Data: revolutionizing database cloning'
 
Denver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualizationDenver devops : enabling DevOps with data virtualization
Denver devops : enabling DevOps with data virtualization
 
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
 
Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix Jonathan Lewis explains Delphix
Jonathan Lewis explains Delphix
 
DevOps, Databases and The Phoenix Project UGF4042 from OOW14
DevOps, Databases and The Phoenix Project UGF4042 from OOW14DevOps, Databases and The Phoenix Project UGF4042 from OOW14
DevOps, Databases and The Phoenix Project UGF4042 from OOW14
 
Delphix for DBAs by Jonathan Lewis
Delphix for DBAs by Jonathan LewisDelphix for DBAs by Jonathan Lewis
Delphix for DBAs by Jonathan Lewis
 
Kscope 14 Presentation : Virtual Data Platform
Kscope 14 Presentation : Virtual Data PlatformKscope 14 Presentation : Virtual Data Platform
Kscope 14 Presentation : Virtual Data Platform
 
Data Virtualization: revolutionizing database cloning
Data Virtualization: revolutionizing database cloningData Virtualization: revolutionizing database cloning
Data Virtualization: revolutionizing database cloning
 
Delphix and DBmaestro
Delphix and DBmaestroDelphix and DBmaestro
Delphix and DBmaestro
 

Kürzlich hochgeladen

Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 

Kürzlich hochgeladen (20)

Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 

Oracle Open World Thursday 230 ashmasters

  • 1. ASH Masters ASH SQL Query Repository Kyle Hailey kylehailey.com Kyle@delphix.com slideshare.net/khailey 10/04/14 1
  • 2. How do you tune a Database? Database is running slow! • first step? • questions? • tools? • repeatable method?
  • 3. What statistics do you look at? Disastrously difficult
  • 4. Imagine Trying to Drive your Car WWoouulldd yyoouu wwaanntt yyoouurr ddaasshhbbooaarrdd ttoo llooookk lliikkee :: AAnndd iiss uuppddaatteedd oonnccee aanndd hhoouurr OOrr wwoouulldd yyoouu lliikkee iitt ttoo llooookk ……
  • 5. How Can We Open the Black Box? ASH Max CPU (yard stick) TToopp AAccttiivviittyy SSQQLL SSeessssiioonnss LLOOAADD Don’t always have OEM, but always have SQL
  • 6. Ideas for Today OOEEMM AASSHH SSaammpplliinngg WWaaiittss Where does the OEM data come from ?
  • 7. Ideas for Today OOEEMM AASSHH SSaammpplliinngg WWaaiittss
  • 8. SSttaattssppaacckk:: CChheeaatt SShheeeett • Install – Connect as SYSDBA –@?/rdbms/admin/spcreate.sql • Run – Exec statspack.snap; • Generate Reports –@?/rdbms/admin/spreport.sql – (AWR : @?/rdbms/admin/awrrpt.sql ) Statspack = always available Copyright 2006 Kyle Hailey
  • 9. SSttaattssppaacckk SSeeccttiioonnss ((100gg)) Instance description Host hardware Snapshot headline Cache information Load profile Instance efficiency Shared pool stats Top timed events Host CPU load Host / Instance CPU warning VM activity Memory usage Time model stats RAC statistics All wait events Background wait events Event histogram SQL x 9 Instance activity Log switches OS stats Latch parent and child Mutex Segment stats x 8 Dictionary cache Library cache RAC (GES) RAC (CR and CUR served) RAC (cache xfer x 2) RAC (Remastering) Streams x 7 Shared pool advisor Java pool advisor SGA resizing SGA target advisor SGA summary SGA detail SQL memory summary Resource limits Parameters Session details x 3 Tablespace I/O File I/O File I/O histogram Buffer pool Instance Recovery Buffer pool advisory Buffer busy waits Various PGA summaries PGA histogram PGA advisory PGA allocation summary PGA allocation top N Enqueue (lock) activity Undo stats x 2 Latch activity Latch miss details
  • 10. SSttaattssppaacckk MMeetthhoodd Top 5 Timed Events ~~~~~~~~~~~~~~~~~~ % Total Event Waits Time (s) Call Time ---------------------- ------------ ----------- --------- buffer busy waits 2,748 250 78.72 CPU time 32 10.16 free buffer waits 1,588 15 4.63 write complete waits 10 8 2.51 log buffer space 306 5 1.51 Load profile good for having a feel for the application and comparing two periods for changes Efficiency ratios misleading carry over from version 6 days ---------------------------------------- Who/When Summary Waits Big Picture
  • 11. LLaattcchh FFrreeee Top 5 Timed Events ~~~~~~~~~~~~~~~~~~ % Total Event Waits Time (s) Ela Time -------------------------------------------- ------------ ----------- -------- latch free 9,652 760 66.10 CPU time 248 21.62 PL/SQL lock timer 41 123 10.72 SQL*Net message from dblink 681 14 1.22 log file parallel write 128 1 .13 ------------------------------------------------------------- What Latch? There are 100s Latch Sleep breakdown for DB: CDB Instance: cdb Snaps: 3 -4 -> ordered by misses desc Latch Name Requests Misses SSlleeeeppss Sleeps 1->4 -------------------------- -------------- ----------- ----------- ------------ ccaacchhee bbuuffffeerrss cchhaaiinnss 88,,444488,,778877 664499,,448844 66,,993300 00//00//00//00//00 library cache pin 8,405,896 82,915 1,427 81537/1330/4 7/1/0 library cache 8,435,488 55,645 1,294 54375/1247/2 2/1/0 shared pool 58,626 7 1 6/1/0/0/0
  • 12. RRooww LLoocckkss 100gg++ op 5 Timed Events Avg %Total ~~~~~~~~~~~~~~~~~~ wait Call Event Waits Time (s) (ms) Time ----------------------------------------- ------------ ----------- ------ ------ enq: TX - row lock contention 59 160 2714 41.8 PL/SQL lock timer 4 117 29291 30.6 CPU time 28 7.2 buffer busy waits 1,217 18 15 4.7 log file parallel write 422 11 27 3.0 Who is waiting Who is blocking What is the SQL What is the row?
  • 13. BBuuffffeerr BBuussyy WWaaiitt Top 5 Timed Events ~~~~~~~~~~~~~~~~~~ % Total Event Waits Time (s) Call Time -------------------------------------------- ------------ ----------- --------- buffer busy waits 2,748 250 78.72 CPU time 32 10.16 free buffer waits 1,588 15 4.63 write complete waits 10 8 2.51 log buffer space 306 5 1.51 ------------------------------------------------------------ Buffer Busy Wait – trying to modify a block Who blocks? What object? what is the SQL? Statspack fails for analysis
  • 14. Ideas for Today OOEEMM AASSHH SSaammpplliinngg WWaaiittss
  • 15. Example • Look at Statspack: TToopp 55 TTiimmeedd EEvveennttss ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %% TToottaall EEvveenntt WWaaiittss TTiimmee ((ss)) CCaallll TTiimmee ------------------------------------------------------ ---------------------- ------------------ bbuuffffeerr bbuussyy wwaaiittss 22,,774488 225500 7788..7722 CCPPUU ttiimmee 3322 1100..1166 ffrreeee bbuuffffeerr wwaaiittss 11,,558888 1155 44..6633 wwrriittee ccoommpplleettee wwaaiittss 1100 88 22..5511 lloogg bbuuffffeerr ssppaaccee 330066 55 11..5511 --------------------------------------------------------------
  • 16. What do we do? • “buffer busy wait” ??? • Need: • SQL • Sessions • Objects • How do we get that information? – Not from Statspack or AWR – But from v$session • v$session_wait prior to 10g
  • 17. V$session • Shows who is waiting – Ex) “buffer busy waits” • Data only exists while waits are happening • Data includes • Sql • Session • Object • Type of buffer busy wait • File and block involved in buffer busy wait • Problem: Once waits are over, data is gone • Solution: Sample data all the time
  • 18. Sample Query select nvl(s.username,s.program) username, s.sid sid, s.serial# serial, s.sql_hash_value sql_hash_value, substr(decode(w.wait_time, 0, w.event, 'ON CPU'),1,15) event , w.p1 p1, w.p2 p2, w.p3 p3 from v$session s, v$session_wait w where w.sid=s.sid and s.status='ACTIVE' and s.type='USER'; SSQQLL iiddeennttiiffiieerr WWaaiittiinngg oorr oonn CCPPUU?? TThhiiss qquueerryy wwoorrkkss ssiinnccee vv77
  • 19. Sampling Output USERNAME SID SERIAL SQL_HASH_V EVENT P1 P2 P3 ---------- ----- -------- ---------- -------------------- -------- -------- ---- SYS 64 8717 4116021597 PL/SQL lock timer 300 0 0 SYS 58 19467 961168820 ON CPU 16508152 1 0 STARGUS 71 6251 1311875676 direct path write 201 2155902 127 (CJQ0) 9 1 0 rdbms ipc message 500 0 0 Run sample query every second and save into a table “v$ash” Create table v$ash as select … ; Insert into v$ash select … ;
  • 20. Buffer busy wait type Buffer Busy Wait P1 = file # P2 = block # P3 = block type SQL> Select count(*), p3 from v$ash where event = 'buffer busy waits' group by p3; COUNT(*) P3 ---------- ---- 3423 1 From v$event_name Or documentation
  • 21. Buffer busy wait type Buffer Busy Wait P3 = block type Block types come from select rownum n, class from v$waitstat; N CLASS 1 data block 2 sort block 3 save undo block 4 segment header 5 save undo header 6 free list 7 extent map 8 1st level bmb 9 2nd level bmb 10 3rd level bmb 11 bitmap block 12 bitmap index block 13 file header block 14 unused 15 system undo header 16 system undo block 17 undo header 18 undo block
  • 22. File and Block #s select count(*), p1 filen, p2 blockn from v$ash where event='buffer busy waits' group by p1, p2, hash_value; COUNT(*) FILEN BLOCKN ---------- -------- -------- 1 11 90644 2 11 90651 3 11 98233 1 11 104767 3 11 113291 1 11 119842 1 11 119856 3 11 121632 1 11 126334 Pick a File and Block to find object
  • 23. Find Object column segment_name format a30 select owner, segment_name, segment_type, block_id, blocks+block_id COUNT(*) FILEN BLOCKN ---------- -------- -------- 1 11 126334 from dba_extents where file_id = 11 and 126334 between block_id AND block_id + blocks-1; OWNER SEGMENT_NAME SEGMENT_TY BLOCK_ID BLOCKS+BLOCK_ID ---------- ------------------ ---------- ---------- --------------- SYSTEM TOTO1 TABLE 125201 127249
  • 24. What SQL ? SQL> select count(*), sql_hash_value 2 from v$ash 3 where event='buffer busy waits' 4 group by hash_value; COUNT(*) SQL_HASH_VALUE ---------- -------------- 3423 558666863 All the same SQL SQL_HASH_VALUE = 558666863 NOTE: Preferable to use SQL_ID
  • 25. SQL Statement ? select sql_text from v$sqltext where hash_value=558666863; SQL_TEXT ----------------------------------------------------- INSERT into toto1 values (:b1,lpad('a',1000,'a')) • Insert statement • Problem on a data block on • table toto1 Solution: Freelists or ASSM
  • 26. Lack of Free List S1 S2 S3 S4 4 Sessions running Insert into toto1 values (null, ‘a’); Commit; OBJN OTYPE FILEN BLOCKN SQL_ID BLOCK_TYPE ----------- ------ ------ ------ ------------- ------------ 54962 TOTO1 TABLE 16 45012 8gz51m9hg5yuf data block 54962 TOTO1 TABLE 16 161 8gz51m9hg5yuf segment header
  • 27. Buffer Busy on Index Solutions 1. Hash Partitions 2. Reverse Keys
  • 28. Sampling Summary • Sampling v$session find root causes • Same data is in : • ASH - Active Session History • v$active_session_history
  • 29. Ideas for Today OOEEMM AASSHH SSaammpplliinngg WWaaiittss
  • 30. vv$$aaccttiivvee__sseessssiioonn__hhiissttoorryy SAMPLE_ID NUMBER SAMPLE_TIME TIMESTAMP(3) SESSION_ID NUMBER SESSION_SERIAL# NUMBER USER_ID NUMBER SERVICE_HASH NUMBER SESSION_TYPE VARCHAR2(10) PROGRAM VARCHAR2(64) MODULE VARCHAR2(48) ACTION VARCHAR2(32) CLIENT_ID VARCHAR2(64) SESSION_STATE VARCHAR2(7) WAIT_TIME NUMBER EVENT VARCHAR2(64) EVENT_ID NUMBER EVENT# NUMBER SEQ# NUMBER P1 NUMBER P2 NUMBER P3 NUMBER WAIT_TIME NUMBER TIME_WAITED NUMBER CURRENT_OBJ# NUMBER CURRENT_FILE# NUMBER CURRENT_BLOCK# NUMBER0 SQL_ID VARCHAR2(13) SQL_CHILD_NUMBER NUMBER SQL_PLAN_HASH_VALUE NUMBER SQL_OPCODE NUMBER QC_SESSION_ID NUMBER QC_INSTANCE_ID NUMBER TIME_WAITED NUMBER When Session State Wait SQL Duration
  • 31. PPrriimmaarryy FFiieellddss ooff AASSHH SAMPLE_TIME Time SESSION_ID SESSION_STATE : WAITING, ON CPU State EVENT : what kind of wait SQL_ID Session Wait SQL Activity : Who, What, When, How Be nice if these were combined
  • 32. GGrroouuppiinnggss –– TToopp CCoonnssuummeerr SESSION_ID SESSION_SERIAL# (identify SID reuse) SESSION_TYPE (FOREGROUND,BACKGROUND) USER_ID (SYS, SYSTEM, SCOTT etc) SERVICE_HASH (OE,GL,HR) MODULE.ACTION (PLSQL tagging) CLIENT_ID (identifying users in session pool) PROGRAM (SQL, JDBC, Forms etc) SQL_ID QC_SESSION_ID (Query Coordinator) QC_INSTANCE_ID (RAC) EVENT + P1, P2, P3 CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# Only for I/O, some locks and buffer busy waits
  • 33. Counting is the key to ASH Seconds (i.e. DB Time) ~= count(*) Select count(*) from ASH where {criteria} and {time period};
  • 34. Counting is the key to ASH AAS = DB Time/elapsed ~ = count(*)/elapsed Select count(*)/{time period in seconds} AAS from ASH where {criteria} and {time period}; AAS = load on the database
  • 35. AAAASS FFoorrmmuullaass Use CPU count as yardstick:  AAS < 1 Database is not blocked  AAS ~= 0 Database basically idle Problems are in the APP not DB  AAS < # of CPUs CPU available Are any single sessions 100% active? • AAS > # of CPUs Could have performance problems  AAS >> # of CPUS There is a bottleneck Ideal world – one database solution track CPU at OS AAS > 1 still want to know if a single user is 100% active
  • 36. TToopp CCPPUU SSeessssiioonn Top CPU consuming Session in last 5 minutes Select session_id, count(*) from v$active_session_history where session_state= ‘ON CPU‘ and SAMPLE_TIME > sysdate – (5/(24*60)) group by session_id order by count(*) desc; Select session_id, count(*) from v$active_session_history where session_state= ‘ON CPU‘ and SAMPLE_TIME > sysdate – (5/(24*60)) group by session_id order by count(*) desc; WWhhoo iiss tthhee rroogguuee sseessssiioonn ??
  • 37. RReessuullttss TToopp CCPPUU SSeessssiioonn NNoott AAAASS,, wwhhaatt ddooeess ccoouunntt mmeeaann?? SESSION_ID COUNT(*) ---------- ---------- SESSION_ID COUNT(*) ---------- ---------- 257 299 263 62 256 32 264 9 277 3 257 299 263 62 256 32 264 9 277 3
  • 38. TToopp CCPPUU SSeessssiioonn Top CPU consuming Session in last 5 minutes Select WWhhoo iiss tthhee rroogguuee sseessssiioonn ?? session_id, count(*)/(5*60) – COUNT/ELAPSED=AAS 100*(count(*)/(5*60) ) -- % active from v$active_session_history where session_state= ‘ON CPU‘ and SAMPLE_TIME > sysdate – (5/(24*60)) group by session_id order by count(*) desc; Select session_id, count(*)/(5*60) – COUNT/ELAPSED=AAS 100*(count(*)/(5*60) ) -- % active from v$active_session_history where session_state= ‘ON CPU‘ and SAMPLE_TIME > sysdate – (5/(24*60)) group by session_id order by count(*) desc; LLaasstt 55 mmiinnuutteess
  • 39. RReessuullttss TToopp CCPPUU SSeessssiioonn AAS/100 = % active SESSION_ID AAS %busy ---------- ---------- --------- SESSION_ID AAS %busy ---------- ---------- --------- 257 .99 99 263 .21 21 256 .11 11 264 .03 3 277 .01 1 257 .99 99 263 .21 21 256 .11 11 264 .03 3 277 .01 1
  • 40. Making a 0-100% bar Select session_id, count(*) , round((count(*)*100)/(5*60),0) "%", lpad('*', 10 * (count(*)/(5*60)), 10 characters wide '*') "Bar" From AAS per session 0-1 v$active_session_history Where session_state= 'ON CPU' and SAMPLE_TIME > sysdate - (5/(24*60)) group by session_id order by count(*) desc /
  • 41. CCPPUU wwiitthh BBaarrss SESSION_ID COUNT(*) % Bar ---------- ---------- ---------- ------------ SESSION_ID COUNT(*) % Bar ---------- ---------- ---------- ------------ 257 299 99 |**********| 263 62 21 |** | 256 32 11 |* | 264 9 3 | | 277 3 1 | | 258 1 0 | | 280 1 0 | | 257 299 99 |**********| 263 62 21 |** | 256 32 11 |* | 264 9 3 | | 277 3 1 | | 258 1 0 | | 280 1 0 | | BBaarr sshhoowwss 1100%% iinnccrreemmeennttss
  • 42. TToopp WWaaiittiinngg SSeessssiioonn • in last 5 minutes Select session_id, count(*) from v$active_session_history where session_state=‘WAITING’ and SAMPLE_TIME > SYSDATE - (5/(24*60)) group by session_id order by count(*) desc; Select session_id, count(*) from v$active_session_history where session_state=‘WAITING’ and SAMPLE_TIME > SYSDATE - (5/(24*60)) group by session_id order by count(*) desc;
  • 43. TToopp WWaaiittiinngg SSeessssiioonn RReessuullttss SESSION_ID COUNT(*) ---------- ---------- SESSION_ID COUNT(*) ---------- ---------- 272 224 254 8 249 5 276 5 277 4 270 1 272 224 254 8 249 5 276 5 277 4 270 1
  • 44. TToopp SSQQLL ffrroomm AASSHH select ash.SQL_ID , sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", sum(decode(ash.session_state,'WAITING',1,0)) - sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "WAIT" , sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "IO" , sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL" from v$active_session_history ash, select ash.SQL_ID , sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", sum(decode(ash.session_state,'WAITING',1,0)) - sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "WAIT" , sum(decode(ash.session_state,'WAITING', decode(en.wait_class, 'User I/O',1,0),0)) "IO" , sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL" from v$active_session_history ash, v$event_name en v$event_name en where SQL_ID is not NULL and en.event#=ash.event# group by sql_id order by sum(decode(session_state,'ON CPU',1,1)) desc where SQL_ID is not NULL and en.event#=ash.event# group by sql_id order by sum(decode(session_state,'ON CPU',1,1)) desc NNoo ttiimmee wwiinnddooww ssppeecciiffiieedd
  • 45. TToopp SSQQLL ffrroomm AASSHH RReessuullttss SQL_ID CPU WAITING IO TOTAL ------------- ---------- ---------- ---------- ---------- 4c1xvq9ufwcjc 23386 0 0 23386 6wjw6rz5uvbp3 99 0 23 122 968dm8hr9qd03 97 0 22 119 938jp5gasmrah 90 0 25 115 cv8xnv81kf582 42 0 9 51 6p9bzu19v965k 21 0 0 21 5zu8pxnun66bu 15 0 0 15 db2jr13nup72v 9 0 0 9 7ks5gnj38hghv 8 0 0 8 SQL_ID CPU WAITING IO TOTAL ------------- ---------- ---------- ---------- ---------- 4c1xvq9ufwcjc 23386 0 0 23386 6wjw6rz5uvbp3 99 0 23 122 968dm8hr9qd03 97 0 22 119 938jp5gasmrah 90 0 25 115 cv8xnv81kf582 42 0 9 51 6p9bzu19v965k 21 0 0 21 5zu8pxnun66bu 15 0 0 15 db2jr13nup72v 9 0 0 9 7ks5gnj38hghv 8 0 0 8
  • 46. TToopp SSeessssiioonn select ash.session_id, ash.session_serial#, ash.user_id, ash.program, sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", sum(decode(ash.session_state,'WAITING',1,0)) - sum(decode(ash.session_state,'WAITING', select ash.session_id, ash.session_serial#, ash.user_id, ash.program, sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", sum(decode(ash.session_state,'WAITING',1,0)) - sum(decode(ash.session_state,'WAITING', select ash.session_id, ash.session_serial#, ash.user_id, ash.program, sum(decode(ash.session_state,'ON CPU',1,0)) "CPU", sum(decode(ash.session_state,'WAITING',1,0)) - sum(decode(ash.session_state,'WAITING', decode(en.wait_class,'User I/O',1, 0 ), 0)) "WAITING" , sum(decode(ash.session_state,'WAITING', decode(en.wait_class,'User I/O',1, 0 ), 0)) "IO" , sum(decode(session_state,'ON CPU',1,1)) "TOTAL" from v$active_session_history ash, decode(en.wait_class,'User I/O',1, 0 ), 0)) "WAITING" , sum(decode(ash.session_state,'WAITING', decode(en.wait_class,'User I/O',1, 0 ), 0)) "IO" , sum(decode(session_state,'ON CPU',1,1)) "TOTAL" from v$active_session_history ash, decode(en.wait_class,'User I/O',1, 0 ), 0)) "WAITING" , sum(decode(ash.session_state,'WAITING', decode(en.wait_class,'User I/O',1, 0 ), 0)) "IO" , sum(decode(session_state,'ON CPU',1,1)) "TOTAL" from v$active_session_history ash, v$event_name en v$event_name en where en.event# = ash.event# group by session_id,user_id,session_serial#,program order by sum(decode(session_state,'ON CPU',1,1)) where en.event# v$event_= name ash.event# en group by session_id,user_id,session_serial#,program order by sum(decode(session_state,'ON CPU',1,1)) where en.event# = ash.event# group by session_id,user_id,session_serial#,program order by sum(decode(session_state,'ON CPU',1,1)) NNoo ttiimmee wwiinnddooww ssppeecciiffiieedd
  • 47. TToopp SSeessssiioonn RReessuullttss SESSION_ID SERIAL# USER_ID PROGRAM CPU WAITING IO ---------- ------- ------- ------------------------- ----- ------- ---- SESSION_ID SERIAL# USER_ID PROGRAM CPU WAITING IO ---------- ------- ------- ------------------------- ----- ------- ---- 247 61970 1 sqlplus 11698 0 0 277 1 0 oracle@labsfrh903 (LGWR) 14 21 0 276 1 0 oracle@labsfrh903 (CKPT) 19 10 0 278 1 0 oracle@labsfrh903 (DBW0) 29 0 0 280 1 0 oracle@labsfrh903 (PMON) 19 0 0 254 22617 5 Executor.exe 13 0 3 255 12877 5 Executor.exe 11 0 5 257 33729 5 Executor.exe 15 0 1 255 13417 5 Executor.exe 14 0 2 247 61970 1 sqlplus 11698 0 0 277 1 0 oracle@labsfrh903 (LGWR) 14 21 0 276 1 0 oracle@labsfrh903 (CKPT) 19 10 0 278 1 0 oracle@labsfrh903 (DBW0) 29 0 0 280 1 0 oracle@labsfrh903 (PMON) 19 0 0 254 22617 5 Executor.exe 13 0 3 255 12877 5 Executor.exe 11 0 5 257 33729 5 Executor.exe 15 0 1 255 13417 5 Executor.exe 14 0 2
  • 48. TToopp SSeessssiioonn ww// UUsseerrnnaammee select select decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED') decode(nvl(to_char(s.sid),-1),-1,'DISCONNECTED','CONNECTED') "STATUS", "STATUS", topsession.session_id "SESSION_ID", u.name "NAME", topsession.program "PROGRAM", max(topsession.CPU) "CPU", max(topsession.WAITING) "WAITING", max(topsession.IO) "IO", max(topsession.TOTAL) "TOTAL" from {previous query} ) topsession , topsession.session_id "SESSION_ID", u.name "NAME", topsession.program "PROGRAM", max(topsession.CPU) "CPU", max(topsession.WAITING) "WAITING", max(topsession.IO) "IO", max(topsession.TOTAL) "TOTAL" from {previous query} ) topsession , v$session s, user$ u where AASSHH u.user# =topsession.user_id and /* outer join to v$session because the session might be disconnected */ topsession.session_id = s.sid (+) and topsession.session_serial# = s.serial# (+) group by topsession.session_id, topsession.session_serial#, topsession.user_id, topsession.program, s.username,s.sid,s.paddr,u.name order by max(topsession.TOTAL) desc v$session s, user$ u where u.user# =topsession.user_id and /* outer join to v$session because the session might be disconnected */ topsession.session_id = s.sid (+) and topsession.session_serial# = s.serial# (+) group by topsession.session_id, topsession.session_serial#, topsession.user_id, topsession.program, s.username,s.sid,s.paddr,u.name order by max(topsession.TOTAL) desc NNoo ttiimmee wwiinnddooww ssppeecciiffiieedd CCoonnnneecctteedd?? UUsseerr nnaammee
  • 49. TToopp SSeessssiioonn FFiinnddiinngg aa RRoogguuee UUsseerr STATUS SESSION_ID NAME PROGRAM CPU WAITING IO --------------- ---------- ---------- ------------------------- ----- ---------- ---- CONNECTED 247 CPU_Monger ChMgr304.exe 11704 0 0 CONNECTED 277 SYS oracle@labsfrh903 (LGWR) 14 19 0 CONNECTED 278 SYS oracle@labsfrh903 (DBW0) 29 0 0 CONNECTED 276 SYS oracle@labsfrh903 (CKPT) 18 9 0 CONNECTED 280 SYS oracle@labsfrh903 (PMON) 20 0 0 DISCONNECTED 255 SYSTEM Executor.exe 11 4 5 DISCONNECTED 257 SYSTEM Executor.exe 13 0 3 DISCONNECTED 255 SYSTEM Executor.exe 14 0 2 DISCONNECTED 257 SYSTEM Executor.exe 13 0 3 STATUS SESSION_ID NAME PROGRAM CPU WAITING IO --------------- ---------- ---------- ------------------------- ----- ---------- ---- CONNECTED 247 CPU_Monger ChMgr304.exe 11704 0 0 CONNECTED 277 SYS oracle@labsfrh903 (LGWR) 14 19 0 CONNECTED 278 SYS oracle@labsfrh903 (DBW0) 29 0 0 CONNECTED 276 SYS oracle@labsfrh903 (CKPT) 18 9 0 CONNECTED 280 SYS oracle@labsfrh903 (PMON) 20 0 0 DISCONNECTED 255 SYSTEM Executor.exe 11 4 5 DISCONNECTED 257 SYSTEM Executor.exe 13 0 3 DISCONNECTED 255 SYSTEM Executor.exe 14 0 2 DISCONNECTED 257 SYSTEM Executor.exe 13 0 3
  • 50. Queries can be complicated • Key to ASH • Difficulties • Pitfalls • Solution
  • 51. Keys to ASH 1. Seconds = COUNT(*) 1. AAS = COUNT(*) / Elapsed 1. Combine CPU state with EVENT decode(session_state, 'ON CPU','ON CPU’, EVENT)
  • 52. Queries can be complicated
  • 53. Solution: ASH Masters, Collection of ASH SQL scripts 1.Load Charts 2.Wait Analysis – locks, latches, bbw 3.SQL elapsed times 4.Top – sql, session, wait, procedure, object 5.I/O •Latency * - not from ASH, but important and related
  • 54. 54 BBeeffoorree AASSHH MMaasstteerrss remember ashrpt.sql 1. ASHRPT – Based entirely on v$active_session_history – @?/rdbms/admin/ashrpt.sql – Exec ASH_REPORT_TEXT/HTML sseelleecctt ** ffrroomm ttaabbllee ((ddbbmmss__wwoorrkkllooaadd__rreeppoossiittoorryy..aasshh__rreeppoorrtt__tteexxtt(( ((sseelleecctt ddbbiidd ffrroomm vv$$ddaattaabbaassee)),, 11,, ssyyssddaattee –– 11//2244,, ssyyssddaattee )))) ;;
  • 55. AASSHHRRPPTT AASSHH RReeppoorrtt FFoorr TTEESSTTDDBB//tteessttddbb DDBB NNaammee DDBB IIdd IInnssttaannccee IInnsstt NNuumm RReelleeaassee RRAACC HHoosstt ------------------------ ---------------------- ------------------------ ---------------- ---------------------- ------ ------------------------ TTEESSTTDDBB 22337711557700553388 tteessttddbb 11 1100..22..00..11..00 NNOO ssddbbee660044aa CCPPUUss SSGGAA SSiizzee BBuuffffeerr CCaacchhee SShhaarreedd PPooooll AASSHH BBuuffffeerr SSiizzee -------- ------------------------------------ ------------------------------------ ------------------------------------ ------------------------------------ AASSHH RReeppoorrtt FFoorr TTEESSTTDDBB//tteessttddbb DDBB NNaammee DDBB IIdd IInnssttaannccee IInnsstt NNuumm RReelleeaassee RRAACC HHoosstt ------------------------ ---------------------- ------------------------ ---------------- ---------------------- ------ ------------------------ TTEESSTTDDBB 22337711557700553388 tteessttddbb 11 1100..22..00..11..00 NNOO ssddbbee660044aa CCPPUUss SSGGAA SSiizzee BBuuffffeerr CCaacchhee SShhaarreedd PPooooll AASSHH BBuuffffeerr SSiizzee -------- ------------------------------------ ------------------------------------ ------------------------------------ ------------------------------------ 22 11,,000000MM ((110000%%)) 446688MM ((4466..88%%)) 111122MM ((1111..22%%)) 44..00MM ((00..44%%)) 22 11,,000000MM ((110000%%)) 446688MM ((4466..88%%)) 111122MM ((1111..22%%)) 44..00MM ((00..44%%)) AAnnaallyyssiiss BBeeggiinn TTiimmee:: 2211--AApprr--0066 1122::0000::0011 AAnnaallyyssiiss BBeeggiinn TTiimmee:: 2211--AApprr--0066 1122::0000::0011 AAnnaallyyssiiss EEnndd TTiimmee:: 2211--AApprr--0066 1122::0055::0011 AAnnaallyyssiiss EEnndd TTiimmee:: 2211--AApprr--0066 1122::0055::0011 EEllaappsseedd TTiimmee:: 55..00 ((mmiinnss)) SSaammppllee CCoouunntt:: 33,,771166 EEllaappsseedd TTiimmee:: 55..00 ((mmiinnss)) SSaammppllee CCoouunntt:: 33,,771166 AAvveerraaggee AAccttiivvee SSeessssiioonnss:: 1122..3399 AAvveerraaggee AAccttiivvee SSeessssiioonnss:: 1122..3399 AAvvgg.. AAccttiivvee SSeessssiioonn ppeerr CCPPUU:: 66..1199 AAvvgg.. AAccttiivvee SSeessssiioonn ppeerr CCPPUU:: 66..1199 RReeppoorrtt TTaarrggeett:: NNoonnee ssppeecciiffiieedd RReeppoorrtt TTaarrggeett:: NNoonnee ssppeecciiffiieedd TToopp UUsseerr EEvveennttss DDBB//IInnsstt:: TTEESSTTDDBB//tteessttddbb ((AApprr 2211 1122::0000 ttoo 1122::0055)) TToopp UUsseerr EEvveennttss DDBB//IInnsstt:: TTEESSTTDDBB//tteessttddbb ((AApprr 2211 1122::0000 ttoo 1122::0055)) AAvvgg AAccttiivvee AAvvgg AAccttiivvee EEvveenntt EEvveenntt CCllaassss %% AAccttiivviittyy SSeessssiioonnss ---------------------------------------------------------------------- ------------------------------ -------------------- -------------------- CCPPUU ++ WWaaiitt ffoorr CCPPUU CCPPUU 6677..9988 88..4422 eennqq:: TTXX -- rrooww lloocckk ccoonntteennttiioonn AApppplliiccaattiioonn 2233..9988 22..9977 bbuuffffeerr bbuussyy wwaaiittss CCoonnccuurrrreennccyy 44..6666 00..5588 llaattcchh:: ccaacchhee bbuuffffeerrss cchhaaiinnss CCoonnccuurrrreennccyy 22..2266 00..2288 EEvveenntt EEvveenntt CCllaassss %% AAccttiivviittyy SSeessssiioonnss ---------------------------------------------------------------------- ------------------------------ -------------------- -------------------- CCPPUU ++ WWaaiitt ffoorr CCPPUU CCPPUU 6677..9988 88..4422 eennqq:: TTXX -- rrooww lloocckk ccoonntteennttiioonn AApppplliiccaattiioonn 2233..9988 22..9977 bbuuffffeerr bbuussyy wwaaiittss CCoonnccuurrrreennccyy 44..6666 00..5588 llaattcchh:: ccaacchhee bbuuffffeerrss cchhaaiinnss CCoonnccuurrrreennccyy 22..2266 00..2288
  • 56. AASSHH RRPPTT 1) General info 2) Top User Events *** 3) Top Background Events 4) Top Event P1/P2/P3 Values 5) Top Service/Module 6) Top Client IDs 7) Top SQL Command Types 8) Top SQL Statements *** 1) General info 2) Top User Events *** 3) Top Background Events 4) Top Event P1/P2/P3 Values 5) Top Service/Module 6) Top Client IDs 7) Top SQL Command Types 8) Top SQL Statements *** 9) Top SQL using literals 10) Top Sessions *** 11) Top Blocking Sessions 12) Top Sessions running PQs 13) Top DB Objects 14) Top DB Files 15) Top Latches 16) Activity Over Time *** 9) Top SQL using literals 10) Top Sessions *** 11) Top Blocking Sessions 12) Top Sessions running PQs 13) Top DB Objects 14) Top DB Files 15) Top Latches 16) Activity Over Time ***
  • 57. AASSHHRRPPTT oovveerr TTiimmee •Waits over Time –Not in AAS • Difficult but better than nothing
  • 58. ASH Masters intro to github 1.Load Charts 2.Wait Analysis – locks, latches, bbw 3.SQL elapsed times 4.Top – sql, session, wait, procedure, object 5.I/O – size, object Extra: Latency * - not from ASH, but important
  • 59. ASH Masters on github.com • https://github.com/khailey/ashmasters
  • 61. 1. Load Charts How to get a quick overview of all the data in the ASH ? Reproduce Active Session OEM tab in SQL 1. Load graph 2. Add Top waits 3. Then from dba_hist_active_sess_history
  • 62. 11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh..ssqqll @ash_graph TIME AAS GRAPH ---------------- ------- ---------------------- 06-AUG 14:00:00 2.24 ++--------2--- 06-AUG 15:00:00 6.67 ++++------2---------- 06-AUG 16:00:00 2.59 ++--------2---- 06-AUG 17:00:00 1.26 ++----- 2 06-AUG 18:00:00 1.38 +++---- 2 06-AUG 19:00:00 1.74 ++------- 2 06-AUG 20:00:00 .99 +---- 2 06-AUG 21:00:00 1.22 ++----- 2 06-AUG 22:00:00 1.66 ++------ 2 06-AUG 23:00:00 1.08 +---- 2 07-AUG 00:00:00 .83 +--- 2 07-AUG 01:00:00 1.74 ++------- 2 07-AUG 02:00:00 2.47 ++--------2---- 07-AUG 03:00:00 6.59 +++-------2---------- @ash_graph TIME AAS GRAPH ---------------- ------- ---------------------- 06-AUG 14:00:00 2.24 ++--------2--- 06-AUG 15:00:00 6.67 ++++------2---------- 06-AUG 16:00:00 2.59 ++--------2---- 06-AUG 17:00:00 1.26 ++----- 2 06-AUG 18:00:00 1.38 +++---- 2 06-AUG 19:00:00 1.74 ++------- 2 06-AUG 20:00:00 .99 +---- 2 06-AUG 21:00:00 1.22 ++----- 2 06-AUG 22:00:00 1.66 ++------ 2 06-AUG 23:00:00 1.08 +---- 2 07-AUG 00:00:00 .83 +--- 2 07-AUG 01:00:00 1.74 ++------- 2 07-AUG 02:00:00 2.47 ++--------2---- 07-AUG 03:00:00 6.59 +++-------2---------- What is this ?
  • 63. 11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh..ssqqll @ash_graph TIME AAS GRAPH ---------------- ------- ---------------------- 06-AUG 13:00:00 .33 +- 2 06-AUG 14:00:00 2.24 ++--------2--- 06-AUG 15:00:00 6.67 ++++------2---------- 06-AUG 16:00:00 2.59 ++--------2---- 06-AUG 17:00:00 1.26 ++----- 2 06-AUG 18:00:00 1.38 +++---- 2 06-AUG 19:00:00 1.74 ++------- 2 06-AUG 20:00:00 .99 +---- 2 06-AUG 21:00:00 1.22 ++----- 2 06-AUG 22:00:00 1.66 ++------ 2 06-AUG 23:00:00 1.08 +---- 2 07-AUG 00:00:00 .83 +--- 2 07-AUG 01:00:00 1.74 ++------- 2 07-AUG 02:00:00 2.47 ++--------2---- 07-AUG 03:00:00 6.59 +++-------2---------- 07-AUG 04:00:00 1.95 ++++++--- 2 07-AUG 05:00:00 3.08 +++++-----2------ @ash_graph TIME AAS GRAPH ---------------- ------- ---------------------- 06-AUG 13:00:00 .33 +- 2 06-AUG 14:00:00 2.24 ++--------2--- 06-AUG 15:00:00 6.67 ++++------2---------- 06-AUG 16:00:00 2.59 ++--------2---- 06-AUG 17:00:00 1.26 ++----- 2 06-AUG 18:00:00 1.38 +++---- 2 06-AUG 19:00:00 1.74 ++------- 2 06-AUG 20:00:00 .99 +---- 2 06-AUG 21:00:00 1.22 ++----- 2 06-AUG 22:00:00 1.66 ++------ 2 06-AUG 23:00:00 1.08 +---- 2 07-AUG 00:00:00 .83 +--- 2 07-AUG 01:00:00 1.74 ++------- 2 07-AUG 02:00:00 2.47 ++--------2---- 07-AUG 03:00:00 6.59 +++-------2---------- 07-AUG 04:00:00 1.95 ++++++--- 2 07-AUG 05:00:00 3.08 +++++-----2------
  • 64. 11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh..ssqqll “-” = WAIT “+” = CPU which waits ?
  • 65. 11.. LLooaadd CChhaarrttss:: aasshh__ggrraapphh__wwaaiittss..ssqqll ash_graph_ash.sql aaddff Top Two Waits
  • 66. 11.. LLooaadd CChhaarrttss:: bbaassiiccss,, ffaakkee qquueerryy Select pseudo columns start_time , bucket_id , count(cpu) , count(waits) from v$active_session_history ash START_TIME BUCKET_ID CPU WAITS ---------- ------------- ---------- ---------- 25-NOV-13 55 397 28231 25-NOV-13 56 80 5631
  • 67. 11.. LLooaadd CChhaarrttss:: ccoommppoonneennttss ID ID = truncate ( seconds in date / seconds in bucket ) (( Julian days * seconds in a day ) + (seconds in last day)) / bucket size in seconds trunc((to_char(sample_time,'J')*(24*60*60)+ to_char(sample_time,'SSSSS'))/&v_secs) Counts , sum(decode(session_state,'ON CPU',1,0)) cpu , sum(decode(session_state,'WAITING',1,0)) waits
  • 68. 11.. LLooaadd CChhaarrttss:: rreeaall qquueerryy select trunc((to_char(sample_time,'J')*(24*60*60)+ ID to_char(sample_time,'SSSSS'))/&v_secs) id CPU , sum(decode(session_state,'ON CPU',1,0)) cpu , sum(decode(session_state,'WAITING',1,0)) waits from v$active_session_history ash -- dba_hist_active_sess_history group by trunc((to_char(sample_time,'J')*(24*60*60)+ to_char(sample_time,'SSSSS'))/&v_secs) ID CPU WAITS ---------- ---------- ---------- 4.2432E+10 1 4 4.2432E+10 9 18 4.2432E+10 8 25 4.2432E+10 9 26 Waits Group by ID
  • 69. 1. Load Charts: how ddoo yyoouu ddrraaww aa llooaadd lliinnee?? If the value of 1 AAS is 5 characters wide then +++++----- Above is AAS of 2 (1 wait, 1 CPU) AAS Width of AAS rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || rpad('-',round((waits/&v_secs)*&v_bars),'-') || Def v_secs=60 -- size bucket in seconds Def v_bars=5 -- size of one AAS
  • 70. 11.. LLooaadd CChhaarrttss:: bbaassiiccss :: ggrraapphhiiccss rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || rpad('-',round((waits/&v_secs)*&v_bars),'-') || rpad(' ',p.value * &v_bars,' '), -- blanks +++++----- 1 +++++----- +++++1----- Trick, add in the number cores 1.Draw full line, cut at core # 2.Add core # 3.Draw full line again cut before first core # || || What about a yard stick ?
  • 71. 11.. LLooaadd CChhaarrttss:: ggrraapphhiiccss Def v_bars=5 -- size of one AAS in characters Def v_graph=80 substr( substr( rpad('+',round((cpu*&v_bars)/&v_secs),'+') || rpad('-',round((waits*&v_bars)/&v_secs),'-') || rpad(' ',p.value * &v_bars,' '), 0,(p.value * &v_bars)) || p.value || substr( First half of line Add core count rpad('+',round((cpu*&v_bars)/&v_secs),'+') || rpad('-',round((waits*&v_bars)/&v_secs),'-') || rpad(' ',p.value * &v_bars,' '), (p.value * &v_bars)) ,0,&v_graph) 2nd half of line +++++----- 1 +++++-----
  • 72. 11.. LLooaadd CChhaarrttss:: bbaassiiccss select Date (from ID) to_char(to_date( trunc((id*&v_secs)/ (24*60*60)) || ' ' || -- Julian days mod((id*&v_secs), (24*60*60)) -- seconds in the day , 'J SSSSS' ), 'MON DD YYYY HH24:MI:SS') start_time, substr( substr( rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || rpad('-',round((waits/&v_secs)*&v_bars),'-') || rpad(' ',p.value * &v_bars,' ’) ,0,(p.value * &v_bars)) || p.value || substr( rpad('+',round(( cpu/&v_secs)*&v_bars),'+’) || rpad('-',round((waits/&v_secs)*&v_bars),'-') || rpad(' ',p.value * &v_bars,' '), (p.value * &v_bars)) ,0,&v_graph) graph Graphics from ( select trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) id , sum(decode(session_state,'ON CPU',1,0)) cpu , sum(decode(session_state,'WAITING',1,0)) waits from v$active_session_history ash group by CPU trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) ) aveact, v$parameter p where p.name='cpu_count' order by id Bar ID WAITS RAW
  • 73. 1. Load Charts : ash_graph.sql START_TIME GRAPH -------------------- -------------------------- NOV 03 2013 22:02:00 ++---1------ NOV 03 2013 22:03:00 ++---1------ NOV 03 2013 22:04:00 +++--1------- NOV 03 2013 22:05:00 +----1- NOV 03 2013 22:06:00 +++--1-- When waiting, which are the top waits ?
  • 74. 1. Load Charts : events ash_graph_waits.sql Select trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) Bucket_id , decode(session_state,'ON CPU','ON CPU',ash.event) event , count(*) event_count From v$active_session_history ash group by trunc((to_char(sample_time,'J')*(24*60*60)+to_char(sample_time,'SSSSS'))/&v_secs) , decode(session_state,'ON CPU','ON CPU',ash.event) BUCKET_ID EVENT EVENT_COUNT ---------- ------------------------------- ----------- 3537592817 control file heartbeat 2 3537592818 ADR block file read 1 3537592818 ARCH wait for process start 3 3 3537592818 ON CPU 9 3537592818 control file parallel write 4
  • 75. 1. Load Charts : per bucket, rank the waits select id , event , row_number() over ( partition by id order by event_count desc ) rank , ratio_to_report( event_count ) over ( partition by id ) pct , sum(decode(event,'ON CPU',event_total,0)) cpu , sum(decode(event,'ON CPU',0,event_total)) waits from ( Previous Query ) chunks group by id, event, event_total ID EVENT RANK PCT CPU WAITS ---------- ----------------------------- ---- --- ---- ----- 3537592818 ON CPU 1 .290 9 0 3537592818 db file sequential read 2 .161 0 5 3537592818 log file switch (checkpoint i 3 .161 0 5 3537592818 control file parallel write 4 .129 0 4 3537592818 ARCH wait for process start 5 .096 0 3 3537592818 ADR block file read 6 .032 0 1 Rank Rank %
  • 76. 1. Load Charts : raw data ash_graph_waits.sql select id , round(max(decode(top.rank,1,pct,null)),2) fpct , max( decode(top.rank,1,decode(top.event,'ON CPU','CPU',event),null)) first , round(max(decode(top.rank,2,pct,null)),2) spct , max( decode(top.rank,2,decode(top.event,'ON CPU','CPU',event),null)) second , sum(waits) waits , sum(cpu) cpu … ID FPCT FIRST SPCT SECOND WAITS CPU ---------- ----- --------------- ----- --------------- ---------- ------ 3537592817 1.00 control file he 2 0 3537592818 .29 CPU .16 db file sequent 22 9 3537592819 .72 control file pa .14 CPU 37 6 3537592820 .75 CPU .25 control file pa 1 3 3537592821 .91 CPU .09 direct path rea 1 10
  • 77. 1. Load Charts : ash_graph_waits.sql TO_CHAR( PCT1 FIRST PCT2 SECOND GRAPH -------- ---- --------------- ---- --------------- ---------------------------------------- 15 19:00 64 CPU 21 db file sequent ++o 4 15 20:00 63 CPU 19 read by other s ++++o- 4 15 21:00 31 db file sequent 24 CPU ++ooo---- 4 15 22:00 35 CPU 24 db file scatter +++++ooooooo--- 4 15 23:00 29 log file sync 25 db file sequent ++++ooooooooo-------4------------- 16 00:00 52 db file sequent 27 CPU ++++++++++oooooooooo4ooooooooooooooo-- 16 01:00 57 CPU 36 db file sequent +++++++++++oooooooo 4 16 02:00 38 db file sequent 21 CPU ++++++oooooooooooo--4--------- 16 03:00 69 db file sequent 20 CPU +++ooooooooooo 4 16 04:00 45 db file sequent 28 CPU o 4 16 05:00 58 db file sequent 24 CPU +ooo 4 16 06:00 41 db file sequent 39 CPU +oo 4 o = I/O + = cpu - = wait OK, what about yesterday?
  • 78. 1. Load Charts : dba_hist_active_sess_history? dba_hist_active_sess_history •Week of ASH data !! (or more) •Only 1 in 10 v$active_session_history rows kept •Has DBID – Can query different databases in same repository MMiinnuutteess eexxeecc ddbbmmss__wwoorrkkllooaadd__rreeppoossiittoorryy..mmooddiiffyy__ssnnaappsshhoott__sseettttiinnggss((1144**2244**6600,,6600));; SELECT retention, snap_interval FROM wwrrmm$$__wwrr__ccoonnttrrooll;; RREETTEENNTTIIOONN SSNNAAPP__IINNTTEERRVVAALL ---------------------------------- ---------------------------------- ++0000001144 0000::0000::0000..00 ++0000000000 0011::0000::0000..00
  • 79. 1. Load Charts: queries with history • V$ACTIVE_SESSION_HISTORY - live – ash_graph_waits.sql – minute buckets Fast, in memory • V$ACTIVE_SESSION_HISTORY + slower DBA_HIST_ACTIVE_SESS_HISTORY – combine – ash_graph_waits_histash.sql – minute buckets • DBA_HIST_ACTIVE_SESS_HISTORY - history only (DBID) – ash_graph_histash_by_dbid.sql - input DBID repositories – ash_graph_histash_by_dbid_program.sql - input DBID and PROGRAM – ash_graph_histash_by_dbid_sqlid.sql - input DBID and a SQL_ID
  • 80. 2. SQL Elapsed times (11g+ ) ASH 11g added sql_exec_id sql_exec_start A SQL executing longer than 1 second will have same will •sql_exec_id •sql_exec_start •sql_id
  • 81. 2. SQL Elapsed times • ash_sql_elapsed.sql – longest running SQL SQL_ID COUNT(*) MX AV MIN ------------- ---------- ------- --------- ---------- 0fvrpk7476b7y 26 3068 133.1 0 1pjp66rxcj6tg 15 3106 767.7 57 • ash_sql_elapsed_hist.sql – with histogram of execution times SQL_ID CT MX MN AV 1 2 3 4 5 ------------- ---------- ---------- ---------- -------- ------ ------ ----- ----- ----- 5k7vccwjr5ahd 2653 1963 0 33.4 2623 15 8 4 3 ds8cz0fb8w147 161 2531 13 273.8 136 18 5 1 1 • ash_sql_elapsed_hist_longestid.sql – execution id of longest running query SQL_ID CT MX MN AV MAX_RUN_TIME LONGEST_SQ 1 2 3 4 5 ------------- ------ ---------- ---- -------- ----------------------------------- ---------- ------ ------ ----- ---- --- 2spgk3k0f7quz 251 29607 0 546.0 11-04-12 12:11:47 11-04-12 20:25:14 16781748 247 2 0 0 2 990m08w8xav7s 591 7681 0 52.0 11-04-13 00:39:27 11-04-13 02:47:28 16786685 587 0 0 2 2
  • 82. 2. SQL Elapsed times: ash_sql_elapsed.sql SQL_ID Executions MX AV MIN ------------- ---------- ------- --------- ---------- 0fvrpk7476b7y 26 3068 133.1 0 1pjp66rxcj6tg 15 3106 767.7 57 8r5wuxk1dprhr 39 3510 841.0 24 0w5uu5kngyyty 21 3652 442.3 0 0hbv80w9ypy0n 161 4089 1183.9 0 71fwb4n6a92fv 49 4481 676.9 30 0bujgc94rg3fj 604 4929 24.7 0 64dqhdkkw63fd 1083 7147 7.2 0 990m08w8xav7s 591 7681 51.8 0 2n5369dsuvn5a 16 10472 5726.8 303 2spgk3k0f7quz 251 29607 546.1 0 36pd759xym9tc 12 37934 23861.9 1391 497wh6n7hu14f 49 69438 5498.2 0
  • 83. 2. SQL Elapsed times : raw data seconds query had been running = Sample_time – sql_exec_start select sql_id, sql_exec_id, id Seconds running (cast(sample_time as date) – cast(sql_exec_start as date)) * (60*60*24) tm from v$active_session_history where sql_exec_id is not null now select max seconds for each sql_exec_id
  • 84. 2. SQL Elapsed times select sql_id, sql_exec_id, max(tm) tm from ( previous query ) Final execution time is max of all execs SQL_ID SQL_EXEC_ID TM ------------- ----------- ---------- acc988uzvjmmt 16777220 3 acc988uzvjmmt 16777335 15 acc988uzvjmmt 16779830 1 acc988uzvjmmt 16781502 7
  • 85. 2. SQL Elapsed times select sql_id, count(*), max(tm) mx, avg(tm) av, min(tm) min from ( previous query ) each SQL_ID •max •min •average execution times SQL_ID COUNT(*) MX AV MIN ------------- ---------- ------- --------- ---------- acc988uzvjmmt 4 15 6.5 1
  • 86. 2. SQL Elapsed times: ash_sql_elapsed.sql SQL_ID COUNT(*) MX AV MIN ------------- ---------- ------- --------- ---------- 0fvrpk7476b7y 26 3068 133.1 0 1pjp66rxcj6tg 15 3106 767.7 57 8r5wuxk1dprhr 39 3510 841.0 24 0w5uu5kngyyty 21 3652 442.3 0 0hbv80w9ypy0n 161 4089 1183.9 0 71fwb4n6a92fv 49 4481 676.9 30 0bujgc94rg3fj 604 4929 24.7 0 64dqhdkkw63fd 1083 7147 7.2 0 What was the distribution?
  • 87. 2. SQL Elapsed times: ash_sql_elapsed_hist.sql Histogram buckets: elapsed time spread SQL_ID CT MX MN AV 1 2 3 4 5 ------------- ---------- ------- ------- -------- ------ ------ ----- ----- -- 401ayw4r7n6kz 1 1983 1983 1983.0 0 0 0 0 1 30hzp85f3qtxj 179 3029 29 111.0 177 1 0 0 1 9k86k2zvht9pt 1 3052 3052 3052.0 0 0 0 0 1 bnddu47dqmzqd 10 3138 68 732.3 7 1 1 0 1 gc7khrc2mx86m 1 3618 3618 3618.0 0 0 0 0 1 8rua4c9agcqkb 978 820 0 72.7 830 116 21 9 2 Bucket interval = max time / 5 820/5 = 164 1. 0 – 164 830 executions 2. 165 – 328 115 executions 3. 329 – 492 21 executions 4. 493 – 656 9 executions 5. 657 – 820 2 executions
  • 88. 2. SQL Elapsed Times ash_sql_elapsed_hist_longestid.sql OK found the longest but •When did it happen? •What was the sql_exec_id of the longest? SQL_ID CT MX MN AV MAX_RUN_TIME LONGEST_SQ 1 2 3 4 5 ------------- ---- ------ ---- ------ ----------------------------------- ---------- ------ ------ ----- ---- --- 30hzp85f3qtxj 179 3029 29 111.0 11-11-07 13:46:12 11-11-07 14:36:41 16777250 177 1 0 0 1 C61wk6d7ssxxc 20 1801 258 743.0 11-11-07 12:01:02 11-11-07 12:31:03 16777216 13 2 0 0 5 769uu28qm4thw 17 1427 0 479.0 11-11-07 14:04:02 11-11-07 14:27:49 16777762 10 2 2 1 2 Fuzcbdt08xjcd 74 315 33 248.0 11-11-07 12:10:05 11-11-07 12:15:20 16790567 5 4 9 5 51 Bkv51bug8ag7c 29 307 1 36.0 11-11-07 11:58:30 11-11-07 12:03:37 16790749 26 2 0 0 1 1wgsn7mmf6kqc 131 299 0 6.0 11-11-07 12:01:08 11-11-07 12:06:07 16784143 130 0 0 0 1 3b7q0hd1q8pw0 17 288 1 118.0 11-11-07 09:42:21 11-11-07 09:47:09 16794374 7 4 0 1 5 1v6yyfy630rkj 13 135 42 65.0 11-11-07 07:49:12 11-11-07 07:51:27 16816140 7 4 1 0 1 1t715k5p9uxxx 50 95 0 32.0 11-11-07 05:17:55 11-11-07 05:19:30 16777225 32 1 1 0 16 A98fbc69py0us 11 91 59 74.0 11-11-07 14:55:55 11-11-07 14:57:26 16777389 1 4 3 2 1 0g53kf4gr3vrg 25 53 32 46.0 11-11-07 15:35:31 11-11-07 15:36:24 16777588 1 0 5 14 5 start End
  • 89. 2. SQL Elapsed Times – lookup by SQL ID Select decode(session_state,'ON CPU','ON CPU’, event) From v$active_session_history Where sql_exec_id = 16777217 Order by sample_id D E CODE(SESSION_STATE,'ONCPU','ONCPU',EVENT) ------------------------------------------------ db file parallel read db file sequential read ON CPU ON CPU ON CPU ON CPU
  • 90. 3. Wait Analysis: v$active_session_history • Buffer busy waits • Enqueue transaction waits
  • 91. 3. Wait Analysis: buffer busy waits Top 5 Timed Events ~~~~~~~~~~~~~~~~~~ % Total Event Waits Time (s) Call Time -------------------------------------------- ------------ ----------- --------- buffer busy waits 2,748 250 78.72 CPU time 32 10.16 free buffer waits 1,588 15 4.63 write complete waits 10 8 2.51 log buffer space 306 5 1.51 ------------------------------------------------------------ Buffer Busy Wait – trying to modify a block Who blocks? What object? what is the SQL? AWR fails
  • 92. 3. Wait Analysis: buffer busy waits To solve Buffer Busy Waits, need •Block type •Object • Table w/ data block => ASM or Freelists, • Index w/data block => reverse or hash partition •File • Temp files problem with extents ash_bbw.sql OBJN OTYPE FILEN BLOCKN SQL_ID BLOCK_TYPE ------------------------- ----------- ------ ------------- ------------ 53218 BBW_INDEX_VAL_I INDEX 1 64826 97dgthz60u28d data block 1 53218 BBW_INDEX_VAL_I INDEX 1 64826 gypmcfzruu249 data block 1 53218 BBW_INDEX_VAL_I INDEX 1 64826 2vd1w5kgnfa5n data block 1 53218 BBW_INDEX_VAL_I INDEX 1 64826 3p3qncvp2juxs data block 1 53218 BBW_INDEX_VAL_I INDEX 1 64826 6avm49ys4k7t6 data block 1
  • 93. 3. Wait Analysis: Joining ASH with v$waitstat select o.object_name obj, o.object_type otype, ash.SQL_ID, w.class from v$active_session_history ash, ( select rownum class#, class from v$waitstat ) w, all_objects o where event='buffer busy waits' and w.class#(+)=ash.p3 and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time; OBJ OTYPE SQL_ID CLASS ------ ------ ------------- ------------------ TOTO1 TABLE 8gz51m9hg5yuf data block TOTO1 TABLE 8gz51m9hg5yuf data block TOTO1 TABLE 8gz51m9hg5yuf segment header TOTO1 TABLE 8gz51m9hg5yuf data block
  • 94. 3. Wait Analysis: How to get Class Name select rownum n,ws.class from v$waitstat; select * from v$event_name where name = 'buffer busy waits' NAME P1 P2 P3 ----------------- ----- ------ ----- buffer busy waits file# block# class# NAME P1 P2 P3 ----------------- ----- ------ ----- buffer busy waits file# block# class# N CLASS 1 data block 2 sort block 3 save undo block 4 segment header 5 save undo header 6 free list 7 extent map 8 1st level bmb 9 2nd level bmb 10 3rd level bmb 11 bitmap block 12 bitmap index block 13 file header block 14 unused 15 system undo header 16 system undo block 17 undo header P3 = class#, how do we get class name?
  • 95. 3. Wait Analysis: tx enqueues Top 5 Timed Events Avg %Total ~~~~~~~~~~~~~~~~~~ wait Call Event Waits Time (s) (ms) Time ----------------------------------------- ------------ ----------- ------ ------ enq: TX - row lock contention 59 160 2714 41.8 PL/SQL lock timer 4 117 29291 30.6 CPU time 28 7.2 buffer busy waits 1,217 18 15 4.7 log file parallel write 422 11 27 3.0 Who is waiting? Who is blocking? What is the SQL? What is the row? Not in AWR report
  • 96. 3. Wait Analysis: buffer busy waits vv$$aaccttiivvee__sseessssiioonn__hhiissttoorryy • Waiter – SESSION_ID – SESSION_SERIAL# – USER_ID • Object – CURRENT_OBJ# – CURRENT_FILE# – CURRENT_BLOCK# • SQL Waiting - SQL_ID • Blocker - BLOCKING_SESSION - BLOCKING_SESSION_STATUS - BLOCKING_SESSION_SERIAL# • Lock Type and Mode - Event = Type (name) - P1 = Type | Mode
  • 97. 3. Wait Analysis: tx enqueue waits select ash_enq.sql to_char(sample_time,’HH MI’) st, substr(event,0,20) lock_name, ash.session_id waiter, mod(ash.p1,16) lmode, ash.p2 p2, ash.p3 p3, o.object_name object, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID waiting_sql, BLOCKING_SESSION blocker from v$active_session_history ash, all_objects o where event like 'enq: T%' and o.object_id (+)= ash.CURRENT_OBJ# / Meaning varies
  • 98. 33.. WWaaiittss:: eennqq TTXX 44 Mode 4, unique key ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID ----- ---------------------- --- --- ------ ---- ----- ----- --- ------ -- 10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158 Mode 4, foreign key ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID ----- ---------------------- --- --- ------ ---- ----- ----- --- ------ -- 10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1 10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1 10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1 Mode 4, bitmap ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID ----- ---------------------- --- --- ------ ---- ----- ----- --- ------ -- 10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144 10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144 10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144 10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144
  • 99. 4. Top • Procedure – ash_top_procedure.sql • Session – ash_top_session.sql - wait, I/O and CPU time • SQL – ash_top_sql.sql - wait, I/O and CPU time – ash_top_sql_w_top_obj.sql - with top OBJ per SQL
  • 100. 4. Top: PROCEDURE ash_top_procedure.sql 1100..22..00..33 AASSHH aaddddeedd PLSQL_ENTRY_OBJECT_ID PLSQL_ENTRY_SUBPROGRAM_ID PLSQL_OBJECT_ID PLSQL_SUBPROGRAM_ID AALLLL__PPRROOCCEEDDUURREESS vviieeww oobbjjeecctt__iidd == ppllssqqll__oobbjjeecctt__iidd ssuubbpprrooggrraamm__iidd == ppllssqqll__ssuubbpprrooggrraamm__iidd 10/04/14 100
  • 101. 4. Top: PROCEDURE ash_top_procedure.sql COUNT(*) SQL_ID calling_code --------- ------------- ------------------------------------------ 2 1xxksrhwtz3zf ORDERENTRY.NEWORDER => DBMS_RANDOM.VALUE 2 1xxksrhwtz3zf ORDERENTRY.NEWORDER => DBMS_LOCK.SLEEP 13 1xxksrhwtz3zf ORDERENTRY.NEWORDER 16 0bzhqhhj9mpaa ORDERENTRY.NEWCUSTOMER 45 41zu158rqf4kf ORDERENTRY.BROWSEANDUPDATEORDERS
  • 102. 4. Top: SESSION ash_top_session.sql STATUS SID NAME PROGRAM CPU WAITING IO TOTAL ------------ ----- ------------ ------------------------- ----- ------- ----- ------ DISCONNECTED 54 SYS oracle@source (J000) 1227 540 152 1919 DISCONNECTED 57 SYS oracle@source (J001) 725 160 18 903 DISCONNECTED 71 SYS sqlplus@source (TNS V1-V3 535 60 36 631 DISCONNECTED 67 SYSTEM LAB128.exe 187 182 148 517 CONNECTED 10 SYS oracle@source (DBW0) 267 171 0 438 CONNECTED 11 SYS oracle@source (LGWR) 10 357 0 367 DISCONNECTED 44 SYS sqlplus@source (TNS V1-V3 103 158 15 276 CONNECTED 53 SYSTEM JDBC Thin Client 129 33 0 162 CONNECTED 36 SYSMAN OMS 6 114 0 120
  • 103. 4. Top: SQL ash_top_sql.sql SQL_ID PLAN_HASH TYPE CPU WAIT IO TOTAL ------------- ---------- ---------- ------- ----- ------- ------ fdtr6ds1nxm5r 1269593971 SELECT 9345 9 84277 93631 5aa7r665a07n6 3761618565 SELECT 82040 6 850 82896 2x8kgb0s9q1zh 0 PL/SQL EXE 75967 1575 1186 78728 4qraawku9303p 2256852101 SELECT 46995 45 3196 50236 3h7agx5ndadrf 1006614515 SELECT 2068 1 24914 26983 8p2cyq3gdgau5 2108428761 SELECT 22345 489 313 23147 7vpqr5zhjm08v 4089415459 SELECT 422 0 19655 20077 7sf51jrzq6y3c 485652470 INSERT 1727 1418 15471 18616 6cy7mc2kj0u4z 3041431021 SELECT 14272 0 0 14272
  • 104. 4. Top: SQL ash_top_sql_w_top_obj.sql SQL_ID SQLPLANHASH AUD_ACT CPU WAIT IO TOTAL PCT_IO TOP_OBJ ------------- ----------- ------- ---- ----- ---- ------- ------- -------------- dr1fpksws4nv9 3458999899 SELECT 3791 0 0 3791 dc9fkz2t3b9p8 1909389838 SELECT 3685 0 5 3690 60 PS_F_ABS_EXPTN_CAL 50spnwj8tdnnh 2849751558 SELECT 1981 57 0 2038 fuzcbdt08xjcd 2618832091 SELECT 0 1864 0 1864 30hzp85f3qtxj 3802366046 SELECT 568 0 921 1489 100 PS_TAX_BALANCE c61wk6d7ssxxc 702141750 SELECT 117 6 1364 1487 98 PS_PAY_DEDUCTION c3y6kdm1uzkb7 2395607145 SELECT 39 0 1375 1414 87 PS_PAY_CHECK 6wsy8rpd0bw26 252818247 SELECT 1363 0 14 1377 64 PS_F_TIALAST_HIST
  • 105. 5. I/O – lots you can do I/O by •SQL •Object •File & Table Space •Parallel Query master and slaves •By type of I/O – Db file sequential read – Db file scattered read – Direct path read – Direct path read temp – Direct path write – Direct path write temp
  • 106. 5. I/O : iosql.sql I/O by SQL and top Objects for that sql AAS SQL_ID % OBJ TABLESPACE ----- ------------- --- --------------- ---------- .18 0yas01u2p9ch4 6 ITEM_PRODUCT_IX SOEINDEX 6 ORDER_ITEMS_UK SOEINDEX 88 ITEM_ORDER_IX SOEINDEX .32 6v6gm0fd1rgrz 6 WAIT_OBJECTS SYSTEM 94 UNDO UNDOTBS1
  • 107. iosql.sql select sum(cnt) over ( partition by io.sql_id order by sql_id ) tcnt, io.sql_id, io.cnt cnt, io.aas aas, io.objn objn, io.obj obj, io.p1 p1, f.tablespace_name tablespace_name from ( select sql_id, count(*) cnt, round(count(*)/(&v_minutes*60),2) aas, CURRENT_OBJ# objn, nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj, o.object_type otype, ash.p1 from v$active_session_history ash ,all_objects o where ( event like 'db file s%' or event like 'direct%' ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &v_minutes/(60*24) group by CURRENT_OBJ#,o.object_name ,o.object_type , ash.p1, sql_id ) io, dba_data_files f where f.file_id = io.p1 Order by tcnt, io.sql_id, io.cnt /
  • 108. Extra : Latency Can’t get latency from: avg(TIME_WAITED) • latency_waitclassmetric.sql – 60 seconds avg by WAIT_CLASS – V$WAITCLASSMETRIC • latency_eventmetric.sql – 60 seconds avg by EVENT – V$EVENTMETRIC • latency_system_event.sql – Hour avg by EVENT – DBA_HIST_SYSTEM_EVENT
  • 109. Latency: Last 60 seconds for I/O waitclass latency_waitclassmetric.sql AVG_IO_MS ---------- 2.032 select 10*time_waited/nullif(wait_count,0) avg_io_ms -- convert centi-seconds to milliseconds from v$waitclassmetric m where wait_class_id= 1740759767 -- User I/O /
  • 110. latency: latency_eventmetric.sql Last 60 seconds NAME TIME_WAITED WAIT_COUNT AVGMS ------------------------- ----------- ---------- ---------- log file parallel write 3.856 12 3.213 log file sync 2.809 6 4.682 db file sequential read 0 0 db file scattered read 0 0 direct path read 0 0 direct path read temp 0 0 direct path write 0 0 direct path write temp 0 0
  • 111. latency: last 60 seconds select -- m.intsize_csec, latency_eventmetric.sql n.name , round(m.time_waited,3) time_waited, m.wait_count, round(10*m.time_waited/nullif(m.wait_count,0),3) avgms from v$eventmetric m, v$event_name n where m.event_id=n.event_id and n.name in ( 'db file sequential read', 'db file scattered read', 'direct path read', 'direct path read temp', 'direct path write', 'direct path write temp', 'log file sync', 'log file parallel write' v$event_metric only had event ids  Join to v$event_name I/O Events
  • 112. Latency: each hour latency_system_event.sql Input event name BTIME AVG_MS ------------------------ ---------- 01-MAY-13 23:00 .199 02-MAY-13 00:00 .023 02-MAY-13 01:00 .031 02-MAY-13 02:00 .006 02-MAY-13 03:00 .017 02-MAY-13 04:00 .015 02-MAY-13 05:00 .013 02-MAY-13 06:00 .019 02-MAY-13 07:00 .017 DBA_HIST_SYSTEM_EVENT DBA_HIST_SNAPSHOT
  • 115. Oramon.sh Usage: oramon.sh [username] [password] [host] [sid] <port=1521> <runtime=3600> Connected, starting collect at Wed Dec 5 14:59:24 EST 2012 starting stats collecting single block logfile write multi block direct read direct read temp direct write temp ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s 3.53 .72 16.06 .17 4.64 .00 115.37 3.73 .00 0 1.66 487.33 2.66 138.50 4.84 33.00 .00 .00 0 1.71 670.20 3.14 195.00 5.96 42.00 .00 .00 0 2.19 502.27 4.61 136.82 10.74 27.00 .00 .00 0 1.38 571.17 2.54 177.67 4.50 20.00 .00 .00 0 single block logfile write multi block direct read direct read temp direct write temp ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s ms IOP/s 3.22 526.36 4.79 135.55 .00 .00 .00 0 2.37 657.20 3.27 192.00 .00 .00 .00 0 1.32 591.17 2.46 187.83 .00 .00 .00 0 2.23 668.60 3.09 204.20 .00 .00 .00 .00 0 https://github.com/khailey/oramon
  • 116. Summary Load on database = AAS = DB Time/elapsed ~ = count(*)/elapsed Select count(*)/{time period in seconds} AAS from ASH where {criteria} and {time period}; Custom queries can give detailed info on • SQL excution, max, min • Top SQL, Session, Procedure, Object • IO by SQL, Object, Tablespace • Detailed wait analysis – BBW, Enqueues etc https://github.com/khailey/ashmasters
  • 117. END
  • 118. 1111..11gg AASSHH eexxttrraass SSQQLL EEllaappsseedd SQL_EXEC_ID SQL_EXEC_START OOppeerraattiioonn bbiitt vveeccttoorr –– nnoonn ttiimmeedd ooppss IN_CONNECTION_MGMT IN_PARSE IN_HARD_PARSE IN_SQL_EXECUTION IN_PLSQL_EXECUTION IN_PLSQL_RPC IN_PLSQL_COMPILATION IN_JAVA_EXECUTION IN_BIND IN_CURSOR_CLOSE SQL_PLAN_LINE_ID SQL_PLAN_OPERATION SQL_PLAN_OPTIONS EETTCC CURRENT_ROW# EVENT# QC_SESSION_SERIAL# CONSUMER_GROUP_ID FLAGS SSQQLL RRooww SSoouurrccee WWhhiicchh iinnssttaannccee rreeqquueesstteedd bblloocckk?? REMOTE_INSTANCE# RReeccuurrssiivvee SSQQLL TOP_LEVEL_SQL_ID TOP_LEVEL_SQL_OPCODE
  • 119. 1111..22gg AASSHH eexxttrraass SSttaattiissttiiccss 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_ALLOCATE Copyright 2006 Kyle Hailey
  • 120. AASSHH AAccrroossss VVeerrssiioonnss 1100..11 1100..22 1100..22..00..33 1111..11 1111..22 When Who SQL ASH instrumentation is exploding across the versions Waits Statistics Blocker
  • 121. I/O Sizes • ash_io_sizes.sql - I/O sizes from ASH
  • 122. I/O • io.sql • io_timestamps.sql • ioag.sql • ioag_orig.sql • iodfpr.sql • ionoobj.sql • ionosql.sql • ioobj.sql • ioobjdec.sql • iop.sql • iosql.sql • iotbs.sql • iotbs1.sql • iotx.sql • jb_sql.txt
  • 123. io.sql - basic I/O EVENT P1 P2 P3 OBJ OTYPE SQL_ID --------------- ----- ---- -- -------------------- ---------- ------------- db file sequent 1 22377 1 -1 7wt7phk4xns75 db file sequent 2 75849 1 -1 13fnb572x6z9j db file sequent 2 78039 1 -1 8tfvwyvfm5cjn db file sequent 1 91095 1 -1 d15cdr0zt3vtp db file sequent 2 321005 1 WRH$_ACTIVE_SESSION_ TABLE PART 25a6sjj8zdbr7 db file scatter 2 331679 3 WRH$_ACTIVE_SESSION_ TABLE PART 25a6sjj8zdbr7 Select substr(event,0,15) event, ash.p1, ash.p2, ash.p3 p3, nvl(o.object_name,CURRENT_OBJ#) obj, o.object_type otype, --CURRENT_FILE# filen, --CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like 'db file s%' and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &minutes/(60*24) Order by sample_time /
  • 124. io_pqo.sql select ash.SQL_ID, QC_SESSION_ID qsid, count(*) cnt, count (distinct session_id) deg, nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, o.object_type otype, decode(session_state, 'WAITING',event,'CPU') event from v$active_session_history ash, all_objects o where o.object_id (+)= ash.CURRENT_OBJ# and qc_session_id is not null group by qc_session_id, sql_id, o.object_name, o.object_type, CURRENT_OBJ#, event, session_state Order by qc_session_id, sql_id SSQQLL__IIDD QQSSIIDD CCNNTT DDEEGG OOBBJJ OOTTYYPPEE EEVVEENNTT -------------------------- -------- -------- ------ ------------------------ ---------- ---------------------------------------------- 77pp33jjtt7755pphhuubb22dd 114444 338866 44 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE PPXX DDeeqq CCrreeddiitt:: sseenndd bbllkkdd 114444 44 33 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE PPXX qqrreeff llaattcchh 114444 3377 11 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE ddbb ffiillee sseeqquueennttiiaall rreeaadd 114444 33 22 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE ddiirreecctt ppaatthh rreeaadd 114444 7700 11 WWAAIITT__OOBBJJEECCTTSS TTAABBLLEE CCPPUU 114444 2211 44 00 PPXX DDeeqq CCrreeddiitt:: sseenndd bbllkkdd 114444 1122 44 00 ddbb ffiillee sseeqquueennttiiaall rreeaadd
  • 125. io_timestamps.sql: time range for I/O by Obj CNT DELTA MNT MXT EVENT OBJN OTYPE --- ------- ----------------- ----------------- --------------- ------------------------- --------------- 15 .0382 04/13/05 18:23:16 04/13/05 19:18:15 direct path wri 232 I_PROCEDUREINFO1 INDEX 15 .0143 04/13/05 18:24:50 04/13/05 18:45:27 direct path wri 222 PROCEDUREINFO$ TABLE 23 .0117 04/13/05 18:25:43 04/13/05 18:42:36 db file scatter 6339 WRH$_SQL_PLAN TABLE 26 .0302 04/13/05 18:32:28 04/13/05 19:15:57 direct path wri 0 59 .1930 04/13/05 18:22:43 04/13/05 23:00:35 db file sequent -1 select count(*) cnt, cast(max(sample_time) as date) - cast(min(sample_time) as date) delta, to_char(cast(min(sample_time) as date),'DD/YY/MM HH24:mi:ss') mnt, to_char(cast(max(sample_time) as date),'DD/YY/MM HH24:mi:ss') mxt, substr(event,0,15) event, CURRENT_OBJ#||' '||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like 'db file s%' or event like 'direct%' ) and o.object_id (+)= ash.CURRENT_OBJ# --and sample_time > sysdate - &minutes/(60*24) group by substr(event,0,15) , CURRENT_OBJ#, o.object_name , o.object_type Order by cnt /
  • 126. ioag.sql - I/O by File# an Tablespace CNT AAS EVENT OBJ P1 TABLESPACE_NAME ---- --- --------------- -------------------- ----- --------------- 10 0 db file sequent 0 2 SYSAUX 12 0 db file sequent WRH$_SEG_STAT 2 SYSAUX 13 0 db file scatter WRH$_ACTIVE_SESSION_ 2 SYSAUX 14 0 db file scatter 77259 7 AWR 22 0 db file sequent 0 1 SYSTEM 23 0 db file scatter WRH$_SQL_PLAN 2 SYSAUX
  • 127. ioag.sql - I/O tablespace select &minutes f_minutes from dual; select io.cnt cnt, io.aas aas, io.event event, substr(io.obj,1,20) obj, io.p1 p1, f.tablespace_name tablespace_name from ( select count(*) cnt, round(count(*)/(&v_minutes*60),2) aas, substr(event,0,15) event, nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj, ash.p1, o.object_type otype from v$active_session_history ash, all_objects o where ( event like 'db file s%' or event like 'direct%' ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &v_minutes/(60*24) group by substr(event,0,15) , CURRENT_OBJ#, o.object_name , o.object_type , ash.p1 ) io, dba_data_files f where f.file_id = io.p1 Order by io.cnt /
  • 128. ioag_orig.sql CNT AAS OBJN OTYPE --- --- --------------------------- --------------- 13 0 77448 WRH$_ACTIVE_SESSION_HI TABLE PARTITION 15 0 222 PROCEDUREINFO$ TABLE 23 0 6339 WRH$_SQL_PLAN TABLE 30 0 0 34 0 232 I_PROCEDUREINFO1 INDEX 37 0 -1 select cnt, --event, round(cnt/nullif((( to_date(beg,'DD/MM/YY HH24:MI:SS')- to_date(end,'DD/MM/YY HH24:MI:SS'))* 24*60*60),0) ,2) aas, objn, otype from ( select count(*) cnt, to_char(nvl(min(sample_time),sysdate), 'DD/MM/YY HH24:MI:SS') end, to_char(nvl(max(sample_time),sysdate), 'DD/MM/YY HH24:MI:SS') beg, substr(event,0,15) event, CURRENT_OBJ#||' '||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like 'db file s%' or event like 'direct% ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &minutes/(60*24) group by substr(event,0,15) , CURRENT_OBJ#, o.object_name , o.object_type ) Order by cnt /
  • 129. iodfpr.sql – db file parallel read CNT P1 P2 P3 OBJ OTYPE SQL_ID --- --- ---- ------------------------- --------- ------------ 1 1 127 127 WRH$_SQL_PLAN TABLE 8jk220sm5y171 1 1 43 43 WRH$_PARAMETER_PK INDEX PAR 03u0y15q547qq 1 1 127 127 WRH$_SQL_PLAN_PK INDEX bvvzxsyxxbnkp 1 1 9 9 WRH$_ROWCACHE_SUMMAR INDEX PAR 2vvqz21zckj64 1 1 113 113 WRH$_LATCH_MISSES_SU INDEX PAR 5c3gr4vusmgcn 1 1 117 117 WRH$_SQL_PLAN TABLE a3rgayp753z59 Select count(*), ash.p1, ash.p2, to_char(ash.p3) p3 , nvl(o.object_name,CURRENT_OBJ#) obj, o.object_type otype, ash.SQL_ID from v$active_session_history ash, all_objects o where event like 'db file p%' and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &minutes/(60*24) group by ash.p1, ash.p2, ash.p3 , o.object_name, CURRENT_OBJ#, o.object_type , ash.SQL_ID order by count(*) /
  • 130. ionoobj.sql – I/O with no Object ID COUNT(*) P1 P2 ------- ----- ---------- 1 2 11522 1 1 24517 1 1 18536 1 201 12422 1 201 11264 2 201 11780 2 201 12416 2 201 11776 select count(*), ash.p1, ash.p2 from v$active_session_history ash where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &minutes/(60*24) and session_state='WAITING' and ( current_obj# = -1 or current_obj#=0 ) group by ash.p1, ash.p2 Order by count(*) /
  • 131. ionosql.sql - I/O with no SQL_ID CNT USERNAME OBJ ---------- --------------- -------------------- 1 SYS 0 select count(*) cnt ,nvl(u.username,ash.user_id) username ,nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj from v$active_session_history ash, all_objects o, dba_users u where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &minutes/(60*24) and session_state='WAITING' and (sql_id is null or sql_id ='') and o.object_id (+)= ash.CURRENT_OBJ# and u.user_id (+) = ash.user_id group by ash.current_obj# ,o.object_name ,u.username ,ash.user_id Order by count(*) /
  • 132. ioobj.sql - I/O by Object CNT AAS OBJN OTYPE ---------- -------------------------- --------------- 15 0 222 PROCEDUREINFO$ TABLE 17 0 77448 WRH$_ACTIVE_SESSION TABLE PARTITION 24 0 6339 WRH$_SQL_PLAN TABLE 32 0 0 36 0 232 I_PROCEDUREINFO1 INDEX 40 0 -1 select &minutes f_minutes from dual; select count(*) cnt, round(count(*)/(&v_minutes*60),2) aas, CURRENT_OBJ#||' '||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like 'db file s%' or event like 'direct%' ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time > sysdate - &v_minutes/(60*24) and session_state='WAITING' group by CURRENT_OBJ#, o.object_name , o.object_type Order by count(*) /
  • 133. ioobjdec.sql - myextents x drop table myextents; l create table myextents as select * from dba_extents; l select count(*), ext.owner, ext.segment_name, ext.partition_name, ext.segment_type from v$active_session_history ash, myextents ext where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &minutes/(60*24) and session_state='WAITING' and ( current_obj# = -1 or current_obj#=0 ) and ext.file_id(+)=ash.p1 and ash.p2 between ext.block_id and ext.block_id + ext.blocks group by ext.owner, ext.segment_name, ext.partition_name, ext.segment_type Order by count(*) /
  • 134. iop.sql – I/O P1,P2,P3 NAME P1 P2 P3 ----------------------- ------------ --------- ---------- read by other session file# block# class# db file sequential read file# block# blocks db file scattered read file# block# blocks db file parallel read files blocks requests direct path read file number first dba block cnt direct path read temp file number first dba block cnt direct path write file number first dba block cnt direct path write temp file number first dba block cnt select name, parameter1 p1, parameter2 p2, parameter3 p3 from v$event_name where name in ( 'db file sequential read', 'db file scattered read', 'db file parallel read', 'read by other session', 'direct path read', 'direct path write', 'direct path read temp', 'direct path write temp', 'direct path write (lob)' );
  • 135. iosql.sql – I/O by SQL_ID breakdown OBJ TCNT SQL_ID CNT AAS OBJN OBJ P1 TABLESPACE_NAME ----- ---------- ---- ---- --- -------------------- -- --------------- 11 3zqmt52j08cby 2 0 -1 0 7 AWR 2 0 521 SYS_LOB0000000520C00 1 SYSTEM 4 0 -1 0 1 SYSTEM 12 a3rgayp753z59 1 0 6342 WRH$_SQL_PLAN_PK 2 SYSAUX 11 0 6339 WRH$_SQL_PLAN 2 SYSAUX 14 52tyrgvbph5fc 14 077259 77259 7 AWR
  • 136. iosql_aas.sql – I/O by SQL_ID break by OBJ AAS SQL_ID CNT PCT OBJ SUB_OBJ OTYPE EVENT F# TBSP CONTENTS ---- ------------- --- ---- ------------------ -------- ---------- ---------- -- ------ -------- .000 a3rgayp753z59 1 8 WRH$_SQL_PLAN_PK INDEX sequentia 2 SYSAUX PERMANENT .000 a3rgayp753z59 11 92 WRH$_SQL_PLAN TABLE scattered 2 SYSAUX PERMANENT .000 2hgxq2u3v0qjc 13 100 WRH$_FILESTATXS_PK WRH$_FILES INDEX PART sequentia 2 SYSAUX PERMANENT .000 2whm2vvjb98k7 6 22 scattered 2 SYSAUX PERMANENT 21 78 sequentia 2 SYSAUX PERMANENT
  • 137. iosql.sql TCNT SQL_ID CNT AAS OBJN OBJ P1 TABLESPACE_NAME ----- ---------- ---- ---- --- -------------------- -- --------------- 11 3zqmt52j08cby 2 0 -1 0 7 AWR 2 0 521 SYS_LOB0000000520C00 1 SYSTEM 4 0 -1 0 1 SYSTEM 12 a3rgayp753z59 1 0 6342 WRH$_SQL_PLAN_PK 2 SYSAUX 11 0 6339 WRH$_SQL_PLAN 2 SYSAUX 14 52tyrgvbph5fc 14 077259 77259 7 AWR select sum(cnt) over ( partition by io.sql_id order by sql_id ) tcnt, io.sql_id, io.cnt cnt, io.aas aas, io.objn objn, io.obj obj, io.p1 p1, f.tablespace_name tablespace_name from ( select sql_id, count(*) cnt, round(count(*)/(&v_minutes*60),2) aas, CURRENT_OBJ# objn, nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj,
  • 138. iotbs1.sql CNT EVENT TABLESPACE_NAME ------- --------------- --------------- 13 direct path wri AWR 18 db file sequent AWR 38 db file scatter AWR 46 db file sequent SYSTEM 58 db file scatter SYSAUX 83 db file sequent SYSAUX select tf.cnt, tf.event, f.tablespace_name from ( select count(*) cnt, substr(event,0,15) event, ash.p1 p1 from v$active_session_history ash where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &minutes/(60*24) group by substr(event,0,15) , ash.p1 ) tf, dba_data_files f where f.file_id = tf.p1 Order by tf.cnt /
  • 139. iotx.sql SQL_ID XID ------------- ---------------- fty6ptn572tt8 fzxxhn9yjhtqm 0900030011070000 g3tvrzsb8rb7j g48azr9sj7ud2 g7rjqg0t81tv6 05000E006E060000 gh2hf1fqppaxr gq841w157yvsp Select ash.sql_id ,ash.xid from v$active_session_history ash where ( event like 'db file s%' or event like 'direct%' ) and sample_time > sysdate - &minutes/(60*24) and session_state='WAITING’ order by sql_id, xid /
  • 141. io_scat.sql EVENT P3 OBJN OTYPE FILEN BLOCKN SQL_ID ----------------------- --- -------------------- ---------- ------ ------- ------------- db file scattered read 5 5904 WRI$_ADV_USAGE TABLE 2 3691 7aum6ufgy2xjq db file scattered read 31 77403 WRH$_LATCH_PK INDEX PART 2 228293 1zkmvr5gjshqk db file scattered read 8 78168 WRH$_SQLSTAT TABLE PART 2 360352 040bmjsqca000 db file scattered read 128 -1 0 0 2whm2vvjb98k7 db file scattered read 124 -1 0 0 2whm2vvjb98k7 db file scattered read 128 -1 0 0 2whm2vvjb98k7 db file scattered read 4 -1 0 0 2whm2vvjb98k7 db file scattered read 6 -1 0 0 2whm2vvjb98k7 db file scattered read 128 -1 0 0 2whm2vvjb98k7 Select event, ash.p3, CURRENT_OBJ#||' '||o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like 'db file scattered read' and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time;
  • 143. cpu_consumed_verses_cpuwait.sql QL> @cpu_consumed_verses_cpuwait.sql CPU_TOTAL CPU_OS CPU_ORA CPU_ORA_WAIT COMMIT READIO WAIT ---------- ---------- ---------- ------------ ---------- ---------- ---------- .088 .086 .002 0 0 0 .002
  • 144. Exporting AWR http://gavinsoorma.com/2009/07/25/exporting-and-importing-awr-snapshot-data/ SQL> CREATE DIRECTORY AWR_DATA AS ‘/u01/oracle/’; SQL> @?/rdbms/admin/awrextr.sql Enter value for directory_name: AWR_DATA Using the dump directory: AWR_DATA Enter value for file_name: awrexp
  • 145. Importing AWR : create tablespace create BIGFILE tablespace AWR datafile '/home/oracle/oradata/${ORACLE_SID}/awr_01.dbf' size 1G NOLOGGING ONLINE PERMANENT EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO ; alter tablespace AWR autoextend on next 200m maxsize unlimited;
  • 146. Importing AWR: drop/recreate user -- create tablespace AWR datafile ’&DATAFILE' size 200M; -- drop directory AWR_DMP; create directory AWR_DMP AS '&AWR_DMP_LOCATION’; -- drop every time drop user awr_stage cascade; create user awr_stage identified by awr_stage default tablespace awr temporary tablespace temp; grant connect to awr_stage; alter user awr_stage quota unlimited on awr; alter user awr_stage temporary tablespace temp;
  • 147. Importing AWR : import dmp file -- Import dump file into stage begin dbms_swrf_internal.awr_load( schname => 'AWR_STAGE', dmpfile => '&DMP_FILE', -- file w/o .dmp dmpdir => 'AWR_DMP'); end; / -- change dbid, give it a new # def dbid=&DBID; @awr_change_dbid
  • 148. Importing AWR : move from Stage, change DBID -- move from stage to SYSAUX def schema_name='AWR_STAGE' select '&schema_name' from dual; variable schname varchar2(30); begin :schname := '&schema_name'; dbms_swrf_internal.move_to_awr(schname => :schname); end; / -- check new DBID col host_name for a30 select distinct dbid, version, db_name, instance_name, host_name from dba_hist_database_instance;
  • 149. • Wait Analysis • ash_bbw.sql - buffer busy • ash_enq.sql - enqueue • Load Charts • V$ACTIVE_SESSION_HISTORY • ash_graph_ash.sql – basic • DBA_HIST_ACTIVE_SESS_HISTORY • ash_graph_ash_histash.sql – • ash_graph_histash_by_dbid.sql - input DBID • ash_graph_histash_by_dbid_program.sql - input DBID and PROGRAM • ash_graph_histash_by_dbid_sqlid.sql - input DBID and a SQL_ID • SQL Elapsed • ash_sql_elapsed.sql - longest running SQL • ash_sql_elapsed_hist.sql – “” with histogram of execution times • ash_sql_elapsed_hist_longestid.sql - “” execution id of longest running query • Top • ash_top_procedure.sql • ash_top_session.sql - wait, I/O and CPU time • ash_top_sql.sql - wait, I/O and CPU time • ash_top_sql_w_top_obj.sql -I/O and CPU time, include top object for I/O waits • Latency • latency_eventmetric.sql - wait event latency from V$EVENTMETRIC, ie last 60 seconds • latency_system_event.sql - wait event latency from DBA_HIST_SYSTEM_EVENT • latency_waitclassmetric.sql - User I/O latency from V$WAITCLASSMETRIC, ie over last 60 seconds • I/O Sizes • ash_io_sizes.sql - I/O sizes from ASH
  • 150. Cool stuff • Querying across RAC nodes • Extrapolating wait times from wait counts
  • 151. aacctt..ssqqll-- aaccttiivviittyy @act Analysis Begin Time : 2007-07-24 11:04:48 Analysis End Time : 2007-07-24 11:19:45 Start time, mins ago: 15 Request Duration : 15 Collections : 528 Data Values : 3327 Elapsed Time: 15 mins @act Analysis Begin Time : 2007-07-24 11:04:48 Analysis End Time : 2007-07-24 11:19:45 Start time, mins ago: 15 Request Duration : 15 Collections : 528 Data Values : 3327 Elapsed Time: 15 mins WAIT_EVENT CNT % Active Ave_Act_Sess -------------------------------------- ---------- ------------ latch free 10 .3 .02 log buffer space 13 .39 .02 buffer busy waits 14 .42 .03 db file scattered read 15 .45 .03 library cache pin 78 2.34 .15 log file sync 213 6.40 .40 ON CPU 726 21.82 1.38 enqueue 855 25.70 1.62 db file sequential read 1399 42.05 2.65 WAIT_EVENT CNT % Active Ave_Act_Sess -------------------------------------- ---------- ------------ latch free 10 .3 .02 log buffer space 13 .39 .02 buffer busy waits 14 .42 .03 db file scattered read 15 .45 .03 library cache pin 78 2.34 .15 log file sync 213 6.40 .40 ON CPU 726 21.82 1.38 enqueue 855 25.70 1.62 db file sequential read 1399 42.05 2.65 ------------ ------------ sum 6.30 sum 6.30
  • 152.  1990 Oracle – 90 support – 92 Ported v6 – 93 France – 95 Benchmarking – 98 ST Real World Performance Who is Kyle Hailey  2000 Dot.Com  2001 Quest  2002 Oracle OEM 10g Success! First successful OEM design
  • 153.  1990 Oracle – 90 support – 92 Ported v6 – 93 France – 95 Benchmarking – 98 ST Real World Performance  2000 Dot.Com  2001 Quest  2002 Oracle OEM 10g  2005 Embarcadero – DB Optimizer Who is Kyle Hailey
  • 154. Who is Kyle Hailey • 1990 Oracle  90 support  92 Ported v6  93 France  95 Benchmarking  98 ST Real World Performance • 2000 Dot.Com • 2001 Quest • 2002 Oracle OEM 10g • 2005 Embarcadero  DB Optimizer • Delphix When not being a Geek - Have a little 4 year old boy who takes up all my time … and now a 2 week old !

Hinweis der Redaktion

  1. This presentation presented a challenge because many of the concepts were like the chicken and the egg. In order to explain one I needed the other. I’ve tried to keep the subjects as linear as possible but sometimes I interweave from one to another.
  2. This presentation presented a challenge because many of the concepts were like the chicken and the egg. In order to explain one I needed the other. I’ve tried to keep the subjects as linear as possible but sometimes I interweave from one to another.
  3. This presentation presented a challenge because many of the concepts were like the chicken and the egg. In order to explain one I needed the other. I’ve tried to keep the subjects as linear as possible but sometimes I interweave from one to another.
  4. This presentation presented a challenge because many of the concepts were like the chicken and the egg. In order to explain one I needed the other. I’ve tried to keep the subjects as linear as possible but sometimes I interweave from one to another.
  5. WAIT_TIME is time of last wait, &amp;gt; 0 , means on CPU TIME_WAITED is the actual wait time
  6. Select session_id, session_serial# , count(*) , round((count(*)*100)/(5*60),0) &amp;quot;%&amp;quot;, lpad(&amp;apos;*&amp;apos;,round((count(*)*10)/(5*60),0),&amp;apos;*&amp;apos;) &amp;quot;Bar&amp;quot; from v$active_session_history where session_state= &amp;apos;ON CPU&amp;apos; and SAMPLE_TIME &amp;gt; sysdate - (5/(24*60)) group by session_id, session_serial# order by count(*) desc /
  7. Select session_id, session_serial# , count(*) , round((count(*)*100)/(5*60),0) &amp;quot;%&amp;quot;, lpad(&amp;apos;*&amp;apos;,round((count(*)*10)/(5*60),0),&amp;apos;*&amp;apos;) &amp;quot;Bar&amp;quot; from v$active_session_history where session_state= &amp;apos;ON CPU&amp;apos; and SAMPLE_TIME &amp;gt; sysdate - (5/(24*60)) group by session_id, session_serial# order by count(*) desc /
  8. w
  9. Graphics – humans can process 400,000 times as much data graphically as textually Think of a map of the US and all the counties with birth rates colored from low to high. It’s a massive about of information textually but it can all be seen on one page of a map Select session_id, session_serial# , count(*) , round((count(*)*100)/(5*60),0) &amp;quot;%&amp;quot;, lpad(&amp;apos;*&amp;apos;,round((count(*)*10)/(5*60),0),&amp;apos;*&amp;apos;) &amp;quot;Bar&amp;quot; from v$active_session_history where session_state= &amp;apos;ON CPU&amp;apos; and SAMPLE_TIME &amp;gt; sysdate - (5/(24*60)) group by session_id, session_serial# order by count(*) desc /
  10. select to_char(start_time,&amp;apos;DD HH24:MI:SS&amp;apos;), samples, substr(substr(rpad(&amp;apos;+&amp;apos;,round((cpu*&amp;v_bars)/&amp;v_secs),&amp;apos;+&amp;apos;) || rpad(&amp;apos;-&amp;apos;,round((waits*&amp;v_bars)/&amp;v_secs),&amp;apos;-&amp;apos;) || rpad(&amp;apos; &amp;apos;,p.value * &amp;v_bars,&amp;apos; &amp;apos;),0,(p.value * &amp;v_bars)) || p.value || substr(rpad(&amp;apos;+&amp;apos;,round((cpu*&amp;v_bars)/&amp;v_secs),&amp;apos;+&amp;apos;) || rpad(&amp;apos;-&amp;apos;,round((waits*&amp;v_bars)/&amp;v_secs),&amp;apos;-&amp;apos;) || rpad(&amp;apos; &amp;apos;,p.value * &amp;v_bars,&amp;apos; &amp;apos;),(p.value * &amp;v_bars),10) ,0,30) graph from ( select start_time , max(samples) samples , sum(decode(event,&amp;apos;ON CPU&amp;apos;,total,0)) cpu , sum(decode(event,&amp;apos;ON CPU&amp;apos;,0,total)) waits from ( select to_date(to_char(sample_time,&amp;apos;YYMMDD&amp;apos;)||&amp;apos; &amp;apos;||trunc(to_char(sample_time,&amp;apos;SSSSS&amp;apos;)/&amp;v_secs)*&amp;v_secs,&amp;apos;YYMMDD SSSSS&amp;apos;) start_time , to_char(sample_time,&amp;apos;YYMMDD&amp;apos;)||trunc(to_char(sample_time,&amp;apos;SSSSS&amp;apos;)/&amp;v_secs) id , decode(ash.session_state,&amp;apos;ON CPU&amp;apos;,&amp;apos;ON CPU&amp;apos;,ash.event) event , sum(decode(session_state,&amp;apos;ON CPU&amp;apos;,1,decode(session_type,&amp;apos;BACKGROUND&amp;apos;,0,1))) total , (max(sample_id)-min(sample_id)+1) samples from v$active_session_history ash group by trunc(to_char(sample_time,&amp;apos;SSSSS&amp;apos;)/&amp;v_secs) , to_char(sample_time,&amp;apos;YYMMDD&amp;apos;) , decode(ash.session_state,&amp;apos;ON CPU&amp;apos;,&amp;apos;ON CPU&amp;apos;,ash.event) ) chunks group by id, start_time ) aveact, v$parameter p where p.name=&amp;apos;cpu_count&amp;apos; order by start_time /
  11. timestamp
  12. col objn for a25 select --ash.p1, --ash.p2, --ash.p3, CURRENT_OBJ#||&amp;apos; &amp;apos;||o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID, w.class from v$active_session_history ash, ( select rownum class#, class from v$waitstat ) w, all_objects o where event=&amp;apos;buffer busy waits&amp;apos; and w.class#(+)=ash.p3 and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time /
  13. col event for a22 col block_type for a18 col objn for a18 col otype for a10 col fn for 99 col sid for 9999 col bsid for 9999 col lm for 99 col p3 for 99999 col blockn for 99999 select to_char(sample_time,&amp;apos;HH:MI&amp;apos;) st, substr(event,0,20) event, ash.session_id sid, mod(ash.p1,16) lm, ash.p2, ash.p3, nvl(o.object_name,ash.current_obj#) objn, substr(o.object_type,0,10) otype, CURRENT_FILE# fn, CURRENT_BLOCK# blockn, ash.SQL_ID, BLOCKING_SESSION bsid --,ash.xid from v$active_session_history ash, all_objects o where event like &amp;apos;enq: TX %&amp;apos; and o.object_id (+)= ash.CURRENT_OBJ# and sample_time &amp;gt; sysdate - &amp;1/(60*24) Order by sample_time /
  14. col block_type for a18 col obj for a20 col otype for a15 col event for a15 col blockn for 999999 col p3 for 999
  15. col qsid for 9999 col cnt for 9999 col deg for 999 col obj for a15 col otype for a10 select ash.SQL_ID, QC_SESSION_ID qsid, count(*) cnt, count (distinct session_id) deg, --ash.p3, nvl(o.object_name,to_char(CURRENT_OBJ#)) obj, o.object_type otype, --CURRENT_FILE# fn, --CURRENT_BLOCK# blockn, decode(session_state, &amp;apos;WAITING&amp;apos;,event,&amp;apos;CPU&amp;apos;) event from v$active_session_history ash, all_objects o where -- event like &amp;apos;direct path read&amp;apos; o.object_id (+)= ash.CURRENT_OBJ# and qc_session_id is not null group by qc_session_id, sql_id, o.object_name, o.object_type, CURRENT_OBJ#, event, session_state Order by qc_session_id, sql_id / ================================ From Greg Rahn select s.sql_id,      px.INST_ID &amp;quot;Inst&amp;quot;,      px.SERVER_GROUP &amp;quot;Group&amp;quot;,      px.SERVER_SET &amp;quot;Set&amp;quot;,      px.DEGREE &amp;quot;Degree&amp;quot;,      px.REQ_DEGREE &amp;quot;Req Degree&amp;quot;,      w.event &amp;quot;Wait Event&amp;quot;from GV$SESSION s, GV$PX_SESSION px, GV$PROCESS p, GV$SESSION_WAIT wwhere s.sid (+) = px.sid and     s.inst_id (+) = px.inst_id and     s.sid = w.sid (+) and     s.inst_id = w.inst_id (+) and     s.paddr = p.addr (+) and     s.inst_id = p.inst_id (+)ORDER BY decode(px.QCINST_ID,  NULL, px.INST_ID,  px.QCINST_ID),        px.QCSID,        decode(px.SERVER_GROUP, NULL, 0, px.SERVER_GROUP),        px.SERVER_SET,        px.INST_ID;
  16. col block_type for a18 col objn for a25 col otype for a15 col event for a15 col blockn for 999999 col aas for 999999 col mxt for a25 col delta for a15 col mnt for a25 /* */ select count(*) cnt, max(sample_time) - min(sample_time) delta, max(sample_time) mxt, min(sample_time) mnt, substr(event,0,15) event, CURRENT_OBJ#||&amp;apos; &amp;apos;||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and o.object_id (+)= ash.CURRENT_OBJ# --and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) and rownum &amp;lt; 10 group by substr(event,0,15) , CURRENT_OBJ#, o.object_name , o.object_type Order by cnt /
  17. ol block_type for a18 col obj for a20 col otype for a15 col event for a15 col blockn for 999999 col f_minutes new_value v_minutes col p1 for 9999 col tablespace_name for a15 select &amp;minutes f_minutes from dual; select io.cnt cnt, io.aas aas, io.event event, substr(io.obj,1,20) obj, io.p1 p1, f.tablespace_name tablespace_name from ( select count(*) cnt, round(count(*)/(&amp;v_minutes*60),2) aas, substr(event,0,15) event, nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj, ash.p1, o.object_type otype from v$active_session_history ash, all_objects o where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time &amp;gt; sysdate - &amp;v_minutes/(60*24) group by substr(event,0,15) , CURRENT_OBJ#, o.object_name , o.object_type , ash.p1 ) io, dba_data_files f where f.file_id = io.p1 Order by io.cnt /
  18. col block_type for a18 col objn for a35 col otype for a15 col event for a15 col blockn for 999999 /* */ select cnt, --event, round(cnt/nullif((( to_date(beg,&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;)- to_date(end,&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;))*24*60*60),0) ,2) aas, objn, otype from ( select count(*) cnt, to_char(nvl(min(sample_time),sysdate),&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;) end, to_char(nvl(max(sample_time),sysdate),&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;) beg, substr(event,0,15) event, CURRENT_OBJ#||&amp;apos; &amp;apos;||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) group by substr(event,0,15) , CURRENT_OBJ#, o.object_name , o.object_type ) Order by cnt /
  19. col block_type for a18 col obj for a20 col otype for a15 col event for a15 col blockn for 999999 col p3 for a30 select count(*), ash.p1, ash.p2, to_char(ash.p3) p3 , nvl(o.object_name,CURRENT_OBJ#) obj, o.object_type otype, ash.SQL_ID from v$active_session_history ash, all_objects o where event like &amp;apos;db file p%&amp;apos; and o.object_id (+)= ash.CURRENT_OBJ# and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) group by ash.p1, ash.p2, ash.p3 , o.object_name, CURRENT_OBJ#, o.object_type , ash.SQL_ID order by count(*) /
  20. col block_type for a18 col objn for a25 col otype for a15 col event for a15 col blockn for 999999 col username for a15 select count(*) cnt ,nvl(u.username,ash.user_id) username ,nvl(o.object_name,decode(CURRENT_OBJ#,-1,0,CURRENT_OBJ#)) obj from v$active_session_history ash, all_objects o, dba_users u where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) and session_state=&amp;apos;WAITING&amp;apos; and (sql_id is null or sql_id =&amp;apos;&amp;apos;) and o.object_id (+)= ash.CURRENT_OBJ# and u.user_id (+) = ash.user_id group by ash.current_obj# ,o.object_name ,u.username ,ash.user_id Order by count(*) /
  21. col block_type for a18 col objn for a25 col otype for a15 col event for a15 col blockn for 999999 col tablespace_name for a15 select &amp;minutes f_minutes from dual; select count(*) cnt, round(count(*)/(&amp;v_minutes*60),2) aas, CURRENT_OBJ#||&amp;apos; &amp;apos;||o.object_name objn, o.object_type otype from v$active_session_history ash, all_objects o where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and o.object_id (+)= ash.CURRENT_OBJ# and sample_time &amp;gt; sysdate - &amp;v_minutes/(60*24) and session_state=&amp;apos;WAITING&amp;apos; group by CURRENT_OBJ#, o.object_name , o.object_type Order by count(*) /
  22. col block_type for a18 col objn for a25 col otype for a15 col event for a15 col blockn for 999999 col segment_name for a20 col partition_name for a15 col owner for a15 set timing on drop table myextents; l create table myextents as select * from dba_extents; l select count(*), ext.owner, ext.segment_name, ext.partition_name, ext.segment_type from v$active_session_history ash, myextents ext where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) and session_state=&amp;apos;WAITING&amp;apos; and ( current_obj# = -1 or current_obj#=0 ) and ext.file_id(+)=ash.p1 and ash.p2 between ext.block_id and ext.block_id + ext.blocks group by ext.owner, ext.segment_name, ext.partition_name, ext.segment_type Order by count(*) /
  23. col p1 for a20 col p2 for a20 col p3 for a20 col name for a40 set linesize 120 select name, parameter1 p1, parameter2 p2, parameter3 p3 from v$event_name where name in ( &amp;apos;db file sequential read&amp;apos;, &amp;apos;db file scattered read&amp;apos;, &amp;apos;db file parallel read&amp;apos;, &amp;apos;read by other session&amp;apos;, &amp;apos;direct path read&amp;apos;, &amp;apos;direct path write&amp;apos;, &amp;apos;direct path read temp&amp;apos;, &amp;apos;direct path write temp&amp;apos;, &amp;apos;direct path write (lob)&amp;apos; ) ;
  24. ol AAS for 99.999 col SQL_ID for A13 col CNT for 9999 col PCT for 999 col OBJ for A20 col SUB_OBJ for A10 col OTYPE for A10 col EVENT for A10 col FILE# for 999 col TABLESPACE_NAME for A15 col CONTENTS for A15 break on sql_id on aas col f_minutes new_value v_minutes select &amp;minutes f_minutes from dual; --select &amp;v_minutes from dual; select round(sum(cnt) over ( partition by io.sql_id order by sql_id ) / (&amp;v_minutes*60),2) aas, io.sql_id, io.cnt cnt, 100*cnt/sum(cnt) over ( partition by io.sql_id order by sql_id ) pct, o.object_name obj, o.subobject_name sub_obj, o.object_type otype, substr(io.event,8,10) event, io.p1 file#, f.tablespace_name tablespace_name, tbs.contents from ( select sql_id, event, count(*) cnt, count(*) / (&amp;v_minutes*60) aas, CURRENT_OBJ# , ash.p1 from v$active_session_history ash where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and sample_time &amp;gt; sysdate - &amp;v_minutes/(60*24) group by CURRENT_OBJ#, event, ash.p1, sql_id ) io, dba_data_files f ,all_objects o , dba_tablespaces tbs where f.file_id = io.p1 and o.object_id (+)= io.CURRENT_OBJ# and tbs.tablespace_name= f.tablespace_name Order by aas, sql_id, cnt /
  25. col block_type for a18 col objn for a25 col otype for a15 col event for a15 col blockn for 999999 select tf.cnt, tf.event, f.tablespace_name from ( select count(*) cnt, substr(event,0,15) event, ash.p1 p1 from v$active_session_history ash where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) group by substr(event,0,15) , ash.p1 ) tf, dba_data_files f where f.file_id = tf.p1 Order by tf.cnt /
  26. col block_type for a18 col objn for a25 col otype for a15 col event for a15 col blockn for 999999 select --count(*) cnt --ash.p1, --ash.p2, ash.sql_id ,ash.xid from v$active_session_history ash where ( event like &amp;apos;db file s%&amp;apos; or event like &amp;apos;direct%&amp;apos; ) and sample_time &amp;gt; sysdate - &amp;minutes/(60*24) and session_state=&amp;apos;WAITING&amp;apos; /* group by --ash.p1, --ash.p2, --ash.sql_id xid --Order by count(*) */ order by sql_id, xid /
  27. col block_type for a18 col objn for a25 col otype for a15 col event for a25 select event, ash.p3, CURRENT_OBJ#||&amp;apos; &amp;apos;||o.object_name objn, o.object_type otype, CURRENT_FILE# filen, CURRENT_BLOCK# blockn, ash.SQL_ID from v$active_session_history ash, all_objects o where event like &amp;apos;db file scattered read&amp;apos; and o.object_id (+)= ash.CURRENT_OBJ# Order by sample_time /
  28. select current_obj#, sum(greatest(1,1/time_waited)) as estimated_io_requests, sum(greatest(1,time_waited)) as estimated_wait_time from v$active_session_history where time_waited &amp;gt; 0 and event=&amp;apos;db file sequential read&amp;apos; group by current_obj# order by 3 desc / select current_obj#, 10*sum(greatest(1,1/time_waited)) as estimated_io_requests, 10*sum(greatest(1,time_waited)) as estimated_wait_time, sum(greatest(1,time_waited))/ sum(greatest(1,1/time_waited)) avg, avg(time_waited), max(time_waited), min(time_waited) from dba_hist_active_sess_history where time_waited &amp;gt; 0 and event=&amp;apos;db file sequential read&amp;apos; group by current_obj# order by 3 desc / select current_obj#, 10*sum(greatest(1,1/time_waited)) as estimated_io_requests, avg(greatest(1,time_waited)) as estimated_wait_time, from dba_hist_active_sess_history where time_waited &amp;gt; 0 and event=&amp;apos;db file sequential read&amp;apos; group by current_obj# order by 3 desc /
  29. set linesize 100 set verify off set echo off set feedback off set heading off column wait_event format a25 column collected new_value _collected column runs new_value _runs column beg new_value _beg column end new_value _end column mins_ago new_value _mins_ago column duration new_value _duration column end_time new_value _end_time select &amp;mins_ago+0 mins_ago, &amp;duration+0 duration from dual; select decode(&amp;_mins_ago,0,15,&amp;_mins_ago) mins_ago , decode(&amp;_duration,0,15,&amp;_duration) duration from dual; select &amp;_mins_ago , &amp;_mins_ago - &amp;_duration end_time from dual; set heading on select nvl(count(*),0) collected, max(sample_id),min(sample_id) , nvl(max(sample_id)-min(sample_id),0)+1 runs, --nvl(min(sample_time),sysdate) beg, --nvl(max(sample_time),sysdate) end to_char(nvl(min(sample_time),sysdate),&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;) beg, to_char(nvl(max(sample_time),sysdate),&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;) end from v$active_session_history where sample_time &amp;gt;= sysdate - (&amp;_mins_ago)/(24*60) and sample_time &amp;lt;= sysdate - (&amp;_end_time)/(24*60) -- and session_type!=81; set termout off set heading off set termout on select &amp;apos;Analysis Begin Time : &amp;apos; || &amp;apos;&amp;_beg&amp;apos; || &amp;apos; &amp;apos;, &amp;apos;Analysis End Time : &amp;apos; || &amp;apos;&amp;_end&amp;apos; || &amp;apos; &amp;apos;, &amp;apos;Start time, mins ago: &amp;apos; || &amp;apos;&amp;_mins_ago&amp;apos; || &amp;apos; &amp;apos;, &amp;apos;Request Duration : &amp;apos; || &amp;apos;&amp;_duration&amp;apos; || &amp;apos; &amp;apos;, &amp;apos;Collections : &amp;apos; || &amp;apos;&amp;_runs&amp;apos; || &amp;apos; &amp;apos;, &amp;apos;Data Values : &amp;apos; || &amp;apos;&amp;_collected&amp;apos; || &amp;apos; &amp;apos;, --&amp;apos;Elapsed Time: &amp;apos; || to_char(round((to_date(&amp;_end)-to_date(&amp;_beg))*24*60))||&amp;apos; mins &amp;apos; &amp;apos;Elapsed Time: &amp;apos; || to_char(round((to_date(&amp;apos;&amp;_end&amp;apos;,&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;)-to_date(&amp;apos;&amp;_beg&amp;apos;,&amp;apos;DD/MM/YY HH24:MI:SS&amp;apos;))*24*60))||&amp;apos; mins &amp;apos; from dual / --where &amp;_collected &amp;gt; 0; set heading on break on report compute sum of &amp;quot;Ave_Act_Sess&amp;quot; on Report select * from ( select substr(decode(session_state,&amp;apos;ON CPU&amp;apos;,&amp;apos;ON CPU&amp;apos;,event),0,25) wait_event, count(*) cnt, round( 100* (count(*)/&amp;_collected) +0.00 , 2.2) &amp;quot;% Active&amp;quot;, round( (count(*)/&amp;_runs) +0.00, 2.2) &amp;quot;Ave_Act_Sess&amp;quot; from v$active_session_history ash where sample_time &amp;gt;= sysdate - &amp;_mins_ago/(24*60) and sample_time &amp;lt;= sysdate - (&amp;_end_time)/(24*60) group by decode(session_state,&amp;apos;ON CPU&amp;apos;,&amp;apos;ON CPU&amp;apos;,event) order by count(*) ) where cnt/&amp;_collected &amp;gt; 0.001 and &amp;_collected &amp;gt; 0 ; set verify on set echo on set feedback on clear computes clear breaks
  30. In Oracle Support I learned more faster than I think I could have anywhere. Porting gave me my first appreciation for the shareable nature of Oracle code and also a bit of disbelief that it worked as well as it did. Oracle France gave me an opportunity to concentrate on the Oracle kernel. At Oracle France I had 3 amazing experiences. First was being sent to the Europecar site where I first met a couple of the people who would later become the founding members of the Oaktable, James Morle and Anjo Kolk. The Europecar site introduced me to a fellow name Roger Sanders who first showed me the wait interface before anyone knew what it was. Roger not only used it but read it directly from shared memory without using SQL. Soon after Europecar I began to be sent often to benchmarks at Digital Europe. These benchmarks were some of my favorite work at Oracle. The benchmarks usually consisted of installing some unknown Oracle customer application and then having a few days to make it run as fast as possible. I first started using TCL/TK and direct shared memory access (DMA) at Digital Europe and got solid hands on tuning experience testing things like striping redo and proving it was faster long before people gave up arguing that this was bad from a theoretical point of view. Finally in France, my boss, Jean Yves Caleca was by far the best boss I ever had, but on top of that he was wonderful at exploring the depths of Oracle and explaining it to others, teaching me much about the internals of block structure, UNDO, REDO and Freelsits. I came back from France wanting to do performance work and especially graphical monitoring. The kernel performance group had limited scope in that domain, so I left for a dot com where I had my first run as the sole DBA for everything, backup, recovery, performance, installation and administration. I was called away by Quest who had my favorite performance tool Spotlight. It turns out thought that scope for expanding Spotlight was limited so I jumped at the chance in 2002 to restructure Oracle OEM. The work at OEM I’m proud of but still want to do much more to make performance tuning faster, easier and more graphical.
  31. In Oracle Support I learned more faster than I think I could have anywhere. Porting gave me my first appreciation for the shareable nature of Oracle code and also a bit of disbelief that it worked as well as it did. Oracle France gave me an opportunity to concentrate on the Oracle kernel. At Oracle France I had 3 amazing experiences. First was being sent to the Europecar site where I first met a couple of the people who would later become the founding members of the Oaktable, James Morle and Anjo Kolk. The Europecar site introduced me to a fellow name Roger Sanders who first showed me the wait interface before anyone knew what it was. Roger not only used it but read it directly from shared memory without using SQL. Soon after Europecar I began to be sent often to benchmarks at Digital Europe. These benchmarks were some of my favorite work at Oracle. The benchmarks usually consisted of installing some unknown Oracle customer application and then having a few days to make it run as fast as possible. I first started using TCL/TK and direct shared memory access (DMA) at Digital Europe and got solid hands on tuning experience testing things like striping redo and proving it was faster long before people gave up arguing that this was bad from a theoretical point of view. Finally in France, my boss, Jean Yves Caleca was by far the best boss I ever had, but on top of that he was wonderful at exploring the depths of Oracle and explaining it to others, teaching me much about the internals of block structure, UNDO, REDO and Freelsits. I came back from France wanting to do performance work and especially graphical monitoring. The kernel performance group had limited scope in that domain, so I left for a dot com where I had my first run as the sole DBA for everything, backup, recovery, performance, installation and administration. I was called away by Quest who had my favorite performance tool Spotlight. It turns out thought that scope for expanding Spotlight was limited so I jumped at the chance in 2002 to restructure Oracle OEM. The work at OEM I’m proud of but still want to do much more to make performance tuning faster, easier and more graphical.
  32. In Oracle Support I learned more faster than I think I could have anywhere. Porting gave me my first appreciation for the shareable nature of Oracle code and also a bit of disbelief that it worked as well as it did. Oracle France gave me an opportunity to concentrate on the Oracle kernel. At Oracle France I had 3 amazing experiences. First was being sent to the Europecar site where I first met a couple of the people who would later become the founding members of the Oaktable, James Morle and Anjo Kolk. The Europecar site introduced me to a fellow name Roger Sanders who first showed me the wait interface before anyone knew what it was. Roger not only used it but read it directly from shared memory without using SQL. Soon after Europecar I began to be sent often to benchmarks at Digital Europe. These benchmarks were some of my favorite work at Oracle. The benchmarks usually consisted of installing some unknown Oracle customer application and then having a few days to make it run as fast as possible. I first started using TCL/TK and direct shared memory access (DMA) at Digital Europe and got solid hands on tuning experience testing things like striping redo and proving it was faster long before people gave up arguing that this was bad from a theoretical point of view. Finally in France, my boss, Jean Yves Caleca was by far the best boss I ever had, but on top of that he was wonderful at exploring the depths of Oracle and explaining it to others, teaching me much about the internals of block structure, UNDO, REDO and Freelsits. I came back from France wanting to do performance work and especially graphical monitoring. The kernel performance group had limited scope in that domain, so I left for a dot com where I had my first run as the sole DBA for everything, backup, recovery, performance, installation and administration. I was called away by Quest who had my favorite performance tool Spotlight. It turns out thought that scope for expanding Spotlight was limited so I jumped at the chance in 2002 to restructure Oracle OEM. The work at OEM I’m proud of but still want to do much more to make performance tuning faster, easier and more graphical.