As DBA we always come accross situation when request comes for queries executed or activities done between two timings. below query works only in enterprise edition and with in awr retention time. modify the timings in the query according to your requirement.
set long 900000
col sql_text for a32767 word_wrapped
COLUMN Sample_Time FOR A25
COLUMN username FOR A20
col MACHINE for a10
COLUMN program FOR A40
COLUMN module FOR A40
SELECT
sample_time,
h.MACHINE,
u.username,
h.program,
h.module,
s.sql_text
FROM
DBA_HIST_ACTIVE_SESS_HISTORY h,
DBA_USERS u,
DBA_HIST_SQLTEXT s
WHERE sample_time
BETWEEN '10/JUN/2020 08:20:00.000' and '10/JUN/2020 08:30:00.000'
AND
INSTANCE_NUMBER=1
AND h.user_id=u.user_id
AND h.sql_id = s.sql_iD
ORDER BY 1
/
set long 900000
col sql_text for a32767 word_wrapped
COLUMN Sample_Time FOR A25
COLUMN username FOR A20
col MACHINE for a10
COLUMN program FOR A40
COLUMN module FOR A40
SELECT
sample_time,
h.MACHINE,
u.username,
h.program,
h.module,
s.sql_text
FROM
DBA_HIST_ACTIVE_SESS_HISTORY h,
DBA_USERS u,
DBA_HIST_SQLTEXT s
WHERE sample_time
BETWEEN '10/JUN/2020 08:20:00.000' and '10/JUN/2020 08:30:00.000'
AND
INSTANCE_NUMBER=1
AND h.user_id=u.user_id
AND h.sql_id = s.sql_iD
ORDER BY 1
/
No comments:
Post a Comment