SET PAUSE ON
SET PAUSE 'Press Return To Continue'
SET HEADING ON
SET LINESIZE 300
SET PAGESIZE 60
COLUMN Sample_Time FOR A12
COLUMN username FOR A20
COLUMN sql_text FOR A40
COLUMN program FOR A40
COLUMN module FOR A40
SELECT
sample_time,
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 '&s_time' and '&e_time'
AND
INSTANCE_NUMBER=&inst_no
AND h.user_id=u.user_id
AND h.sql_id = s.sql_iD
ORDER BY 1
/
SELECT *
FROM dba_hist_active_sess_history
WHERE sample_time
BETWEEN '&s_time'
AND '&e_time'
ORDER BY sample_time ASC
/