>DBA SQL -3 Advanced

>/* ### Top 10 by Buffer Gets:#####
/* ### Buffer uzerinden 10000’den fazla bilgi alan ilk 10 sql listesi

set linesize 250
set pagesize 250
SELECT * FROM (SELECT substr(sql_text,1,40) sql, buffer_gets, executions, buffer_gets/executions “Gets/Exec”, hash_value,address
FROM V$SQLAREA
WHERE buffer_gets > 10000
ORDER BY buffer_gets DESC)
WHERE rownum <= 10;
/* ### Top 10 by Physical Reads:#####
/* ### Disk uzerinden okuma sayisi 1000’den fazla olan ilk 10 sql listesi.
/* ### Disk uzerinden okuma ne kadar fazla ise performans o kadar kotudur. Bu yuzden bu sql’lerin tekrardan gozden gecirilmesi gerekir.

set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
disk_reads, executions,– disk_reads/executions “Reads/Exec”,
hash_value,address
FROM V$SQLAREA
WHERE disk_reads > 1000
ORDER BY disk_reads DESC)
WHERE rownum <= 10;
/* ### Top 10 by Executions:#####
/* ### sql bazinda calisan sayisi 100’den fazla olan 10 SQL cumleciginin listesi.
/* ### Bir sql ne kadar cok calisiyorsa o sql’lin yaptigi is kullanicilar tarafindan cok kullaniliyor demektir. Bu tur is kurallarini gozden gecirmek tavsiye edilir.

set linesize 100
set pagesize 100
SELECT * FROM (SELECT substr(sql_text,1,40) sql, executions, rows_processed, rows_processed/executions “Rows/Exec”, hash_value, address
FROM V$SQLAREA
WHERE executions > 100
ORDER BY executions DESC)
WHERE rownum <= 10;
/* ### Top 10 by Parse Calls:#####
/* ### Degiskenlerin parametre olarak gecmedigi tipteki sql’lerin sayisinin 1000’den fazla olan 10 SQL cumleciginin listesi.

set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql, parse_calls, executions, hash_value,address
FROM V$SQLAREA
WHERE parse_calls > 1000
ORDER BY parse_calls DESC)
WHERE rownum <= 10;

/* ### Top 10 by Shareble Memory:#####
/* ### 1048576 byte’dan daha fazla bellek kullanan en ustteki 10 SQL cumleciginin listesi.
/* ### Bir sql calistigi ortamda cok daha fazla bellek tuketmemesi gerekir. Buna dikkat edilmesi tavsiye edilir.

set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,sharable_mem, executions, hash_value,address
FROM V$SQLAREA
WHERE sharable_mem > 1048576
ORDER BY sharable_mem DESC)
WHERE rownum <= 10;
/* ### Top 10 by Version Count:#####
/* ### Degisik parametrelerle calistirilan sql’lerin version sayisi 20’den fazla olan 10 SQL cumleciginin listesi.
/* ### Bir sql degisik parametrelerle calistiriliyorsa her defasinda derlenir bu da hem performans hem de bellek acisindan olumsuz durum demektir. BIND variable degerleri kullanarak sql’lerin her defasinda degisik sekilde calistirilmamasina dikkat edilmesi tavsiye edilir.

set linesize 100
set pagesize 100
SELECT * FROM
(SELECT substr(sql_text,1,40) sql,
version_count, executions, hash_value,address
FROM V$SQLAREA
WHERE version_count > 20
ORDER BY version_count DESC)
WHERE rownum <= 10;

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s