解決db file sequential read與db file scattered read

lfree發表於2006-03-14

1.根據收集的等待事件,分析是那些物件以及對應的sql。

2.確定是那些物件,執行如下:

SELECT segment_name, partition_name, p1, p2
FROM dba_extents, wait1
WHERE wait1.p2 BETWEEN block_id AND (block_id + blocks - 1)
AND file_id = wait1.p1
ORDER BY segment_name

3.確定執行的sql語句,執行如下:

SELECT hash_value, address, piece, sql_text
FROM v$sqltext
WHERE hash_value IN (SELECT DISTINCT sql_hash_value
FROM wait1)
ORDER BY hash_value, piece;

SELECT hash_value, address, piece, sql_text
FROM v$sqltext
WHERE hash_value = :1
ORDER BY hash_value, piece;

注意這個有可能一些已經不在shared pool。

4.另外透過這個指令碼也可以確定物件,缺點這個塊一定要讀入sga。

SELECT DISTINCT a.object_name, a.subobject_name
FROM dba_objects a, SYS.x_$bh b
WHERE (a.object_id = b.obj OR a.data_object_id = b.obj)
AND b.file# = :p1
AND b.dbablk = :p2 ;


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-82824/,如需轉載,請註明出處,否則將追究法律責任。

相關文章