解決direct path read 與 direct path write問題

lfree發表於2006-03-15

1.這個問題主要與sort有關。

2.確定物件的sql:

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

3.根據回話讀取的資料庫檔案型別瞭解回話所做的事情。如果是臨時檔案,則回話正在讀取先前透過direct path write操作的臨時段。如果是資料檔案,可能是並行查詢從屬操作在工作。

SELECT NAME
FROM v$datafile
WHERE file# = :p1
UNION ALL
SELECT a.NAME
FROM v$tempfile a, v$parameter b
WHERE b.NAME = 'db_files' AND a.file# + b.VALUE = :p1

4.如果回話讀取臨時段,要查明是什麼型別的段:

SELECT DISTINCT DECODE (ktssosegt,
1, 'SORT',
2, 'HASH',
3, 'DATA',
4, 'INDEX',
5, 'LOB_DATA',
6, 'LOB_INDEX',
'UNDEFINED'
)
FROM SYS.x$ktsso
WHERE inst_id = USERENV ('instance')
AND ktssoses = :cursor_session_address
AND ktssosno = :cursor_serial# ;

5.獲取sql語句:

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


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

相關文章