
云和恩墨 成就所托 www.enmotech.com
2
to_char(LAST_CALL_ET) as seconds, c.last_active_time
from v$session a, v$process b, v$sqlarea c
where a.paddr = b.addr(+) and a.sql_hash_value = c.hash_value(+)
and a.sql_address = c.address(+) and a.type = 'USER'
and a.event not like 'SQL*Net%'
order by c.sql_id, a.machine
/
b) 检查异常 SQL 当前执行信息:
select sql_id,sql_profile,
executions,plan_hash_value,
elapsed_time / DECODE(executions, 0, 1, EXECUTIONS) / 1000 elasp_time_ms,
buffer_gets / DECODE(executions, 0, 1, EXECUTIONS),
disk_reads / DECODE(executions, 0, 1, EXECUTIONS),
cpu_time / DECODE(executions, 0, 1, EXECUTIONS)/1000 cpu_time_ms,
last_load_time,last_active_time,
sql_text,child_number
from v$sql
where SQL_ID IN ('&sql_id');
检查 SQL 每次执行时间是否过长,逻辑读,物理读是否很大?建议对 elasped_time 和
cpu_time 时间粒度取 ms,不 要 取 s,因 为 对 于 有 些 高 并 发 的 SQL,业 务 要 求 响 应 时 间 都 是 几
ms 到几十 ms,如果用 s 作为单位则不利于判断 SQL 的性能变化
c) 查看异常 SQL 历史执行计划:
如果查看某个 SQL 的历史性能,需要考虑的视图是 DBA_HIST_SQLSTAT 视图,如下查看
某个 SQL 的历史执行信息:
文档被以下合辑收录
评论