Whats Running?
Whats Running?
This query shows details about currently active user sessions, including session ID, username, machine, and the SQL text being executed:
SELECT s.sid, s.serial#, s.username, s.osuser, s.machine, s.program, q.sql_textFROM v$session sJOIN v$sql q ON s.sql_id = q.sql_idWHERE 1=1 AND s.type = 'USER' AND s.status = 'ACTIVE'ORDER BY s.sid;This query shows the progress of long-running operations such as materialized view refreshes. It calculates the percentage of work completed.
SELECT sid, serial#, opname, context, sofar, totalwork, ROUND((sofar / totalwork) * 100, 2) AS "%_COMPLETE"FROM v$session_longopsWHERE 1=1 AND opname LIKE 'REFRESH MATERIALIZED VIEW%' AND totalwork > 0 AND sofar != totalworkORDER BY "%_COMPLETE" DESC;