Monday 17 June 2019

How to find out a query which used a lot of TEMP space in the past? dba_hist_active_sess_history to the rescue

select SQL_ID,TEMP_SPACE_ALLOCATED
from dba_hist_active_sess_history
where SAMPLE_TIME between to_date('2019-06-16 15:14:00','yyyy-mm-dd hh24:mi:ss') and to_date('2019-06-16 15:17:00','yyyy-mm-dd hh24:mi:ss')
and TEMP_SPACE_ALLOCATED is NOT null
order by TEMP_SPACE_ALLOCATED
/