Reputation: 11
I want to get the list of SQL_Id executed between a beginning snapshot and the end snapshot time in Oracle. We can get the list from the AWR report but I need a SQL query which will return all the SQL IDs. SQL Id is present in the V$SQL table but there isn't any column for snapshot time.
UI
Tried to get idea from the below queries-
select * from V$SQL;
desc V$SQL;
SELECT * FROM dba_hist_snapshot;
Upvotes: 1
Views: 865
Reputation: 7846
Maybe this could help you to connect SQL_ID with SNAP_ID
SELECT
ids.SQL_ID,
snp.SNAP_ID, snp.STARTUP_TIME, snp.BEGIN_INTERVAL_TIME, snp.END_INTERVAL_TIME
FROM
dba_hist_snapshot snp
Inner Join
DBA_HIST_SQLSTAT ids ON(ids.SNAP_ID = snp.SNAP_ID)
Upvotes: 1