SQL調整

--下面是查找Oracle那句SQL語法執行比較慢

SELECT * FROM
(
SELECT PARSING_USER_ID
EXECUTIONS,
SORTS,
COMMAND_TYPE,
DISK_READS,
sql_text
FROM v$sqlarea
ORDER BY disk_reads DESC
)
WHERE ROWNUM<10 ;

--下面是查找那句SQL語法執行時佔CPU比較高
SELECT a.username, a.machine, a.program, a.sid, b.spid, a.serial#, a.status,
c.piece, c.sql_text
FROM v$session a, v$process b, v$sqltext c
WHERE  b.addr = a.paddr
AND a.sql_address = c.address(+)
AND b.spid ='27999'  -- TOP PID
ORDER BY c.piece;

posted @ 2008-06-18 15:39  jimeper  阅读(277)  评论(0编辑  收藏  举报