Oracle > SQLパフォーマンス調査

2014-02-10 17:50:21 (Mon);

チューニング候補のSQL抽出①:~ディスクアクセス多いもの~
select
	rpad(substrb(e.username,1,10),10) username
	,to_char(c.disk_reads,'999999999') disk_reads
	,c.executions
	,c.rows_processed
	,e.osuser
	,e.program
	,c.hash_value
	,c.sql_text
from 
	v$sqlarea c,v$open_cursor d,v$session e
where
 	c.hash_value = d.hash_value
	and d.hash_value = e.sql_hash_value
	and d.saddr = e.saddr
	and c.executions > 0
	and c.disk_reads/c.executions > 10
order by
	disk_reads


チューニング候補のSQL抽出②~待機イベントから~
select b.sid,b.userName,c.sql_text,b.sql_hash_value from v$session_wait a,v$session b,v$sql c
where a.sid=b.sid and b.sql_hash_value=c.hash_value and b.sql_address=c.address
and a.event='db file scattered read';


v$session から取得しているので、セッションが残っているときに実施。


HASH_VALUE の値をメモっておき、V$SQLTEXT を問合せ。
select * from V$SQLTEXT
where HASH_VALUE ='736172814'
order by PIECE


表示されるSQLを確認し、チューニグの是非を確認。
※整形されていないのでめんどくさいです。。





最終更新:2014年02月10日 17:50