命中率及查詢有問題sql

zgy13121發表於2011-10-12
--查詢v$librarycache: select sum(pins) "Executions", sum(pinhits) "Hits", ((sum(pinhits) / sum(pins)) * 100) "PinHitRatio", sum(reloads) "Misses", ((sum(pins) / (sum(pins) + sum(reloads))) * 100) "RelHitRatio" from v$librarycache; --查詢 v$sql_bind_capture,看看 average binds 是否大於15 (issue): select sql_id, count(*) bind_count from v$sql_bind_capture where child_number = 0 group by sql_id having count(*) > 20 order by count(*); --查詢有問題的SQL並修復它: select sql_text, users_executing, executions, users_opening, buffer_gets from v$sqlarea where sql_id = 'c0agatqzq2jzr' order by buffer_gets;[@more@]另: 透過以下sql,可查詢最耗時sql,想辦法最佳化: Select * From v$sqlarea Order By cpu_time Desc

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

相關文章