select ss.instance_number node,
begin_interval_time,
sql_id,
plan_hash_value,
nvl(executions_delta, 0) exe_num, --执行次数
trunc(elapsed_time_delta / 1000000) exe_time,--执行时间
trunc((elapsed_time_delta / decode(nvl(executions_delta, 0), 0, 1, executions_delta)) / 1000000) avg_exe_time,--平均执行时间
buffer_gets_delta lg_read,--逻辑读
trunc((buffer_gets_delta / decode(nvl(buffer_gets_delta, 0), 0, 1, executions_delta))) avg_lg_read --平均逻辑读
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS
where sql_id = 'b5tm22kaqf7nx'--问题sql语句的sql_id值
and ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and s.instance_number=1
and executions_delta > 0
and s.begin_interval_time >= sysdate - 4 --最近四天
order by NODE,BEGIN_INTERVAL_TIME;