It is easy to find queries that have been running and that have executed previously during the session using TOAD in the Oracle database. But we may not always find such tools. Therefore, we may need to use queries for such situations.
We may use the following query to find which queries have executed previously or which queries are currently running in the existing sessions in the database.
With the following query, we can see the queries that are currently running, as well as the queries that have executed previously during the session.
FROM gv$open_cursor o, gv$session s
WHERE o.saddr = s.saddr
AND o.sid = s.sid
AND o.inst_id = s.inst_id