How to identify all queries in a pending transaction in Oracle? Let's say I have a pending transaction that shows in select * from v$transaction. Is there a way to identify all queries executed so far in the pending transaction?
I'm pretty sure you can only view the most recent SQL of the transaction. Oracle records transactions at the block level, not at SQL level, so this information is not retained. 

To see the most recent SQL, join the SES_ADDR column of v$transaction with the SADDR column of v$session. e.g.

SELECT a.sid, a.username, b.xidusn, b.used_urec, b.used_ublk, b.status
  FROM v$session a, v$transaction b
  WHERE a.saddr = b.ses_addr
  order by b.used_urec;


You can then join the sql_id from v$session with v$sql to see the most recent SQL for the session. e.g.

select sql_id,sql_text from v$sql where sql_id in
    (select sql_id from v$session where sid=&amp;sid);


You'd need to join the sessionid with the dba_hist_active_sess_history table to see more SQL executed by the session. Even then it will not neccessarily be a complete list, as this view works by periodic polling.

You could use tracing or auditing if you wanted a list of all SQLs for specific sessions, but again this would not be recorded at the transaction level. Perhaps you could compare this result with the start_date or start_scn from v$transaction to figure out which SQLs belonged to which transaction.