To trace query executed for Oracle

This is the query to identify what query were executed on my machine.

Since Oracle doesn’t have Profiler as SQL Profiler, this is the script that we can get through Oracle SQL Developer.

SELECT a.PROGRAM,
       a.OSUSER,
       a.LOGON_TIME,
       TO_CHAR(a.LOGON_TIME, 'YYYY-MM-DD:HH24:MI:SS') LogonTime,
       a.SID, /*c.piece,*/
       c.SQL_ID,
       c.SQL_FULLTEXT,
       c.CHILD_NUMBER
  from v$Session a
           Inner join V$OPEN_CURSOR b on a.SID = b.SID
           Inner join V$SQL c  on c.SQL_ID = b.SQL_ID
where a.UserName = '<username>'
       and a.MACHINE like '%<machinename>%'
       and a.LOGON_TIME > TO_DATE('2018-12-06:14:42:57', 'YYYY-MM-DD:HH24:MI:SS')
       and c.CHILD_NUMBER = '0'
Order by a.LOGON_TIME;

 

Leave a Reply