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;