How to find running SQL queries – Oracle

Running queries with performance metrics

SELECT
  S.SQL_ID,
  S.MODULE, 
  S.SQL_TEXT, 
  U.USERNAME, 
  ROUND((S.DISK_READS/DECODE(S.EXECUTIONS,0,1, S.EXECUTIONS)),2) DISK_READS_PER_EXEC, 
  S.DISK_READS, 
  S.BUFFER_GETS, 
  S.PARSE_CALLS, 
  S.SORTS, 
  S.EXECUTIONS, 
  S.ROWS_PROCESSED, 
  100 - ROUND(100 *  S.DISK_READS/GREATEST(S.BUFFER_GETS,1),2) HIT_RATIO, 
  S.FIRST_LOAD_TIME, 
  S.SHARABLE_MEM, 
  S.PERSISTENT_MEM, 
  S.RUNTIME_MEM, 
  S.CPU_TIME, 
  S.ELAPSED_TIME
FROM
  SYS.V_$SQL S, 
  SYS.ALL_USERS U 
WHERE
  S.PARSING_USER_ID=U.USER_ID 
AND 
  UPPER(U.USERNAME) NOT IN ('SYS','SYSTEM') 
ORDER BY 
  5 DESC

SQL query in pieces

SELECT
  *
FROM
  SYS.V_$SQLTEXT
WHERE
  SQL_ID = '68du231hjcykn'
ORDER BY 
  SQL_ID, PIECE;

SQL query concatenated

SELECT 
  SQL_ID, LISTAGG(SQL_TEXT, '') WITHIN GROUP (ORDER BY PIECE)
FROM 
  SYS.V_$SQLTEXT
WHERE
  SQL_ID = '68du231hjcykn'
GROUP BY 
  SQL_ID;

Bind variables

SELECT 
  * 
FROM
  V$SQL_BIND_CAPTURE B 
WHERE
  SQL_ID = '68du231hjcykn';