Skip to content

Instantly share code, notes, and snippets.

@teopost
Last active August 3, 2017 08:56
Show Gist options
  • Select an option

  • Save teopost/e642af022485ffa83bf6930dad8e63b7 to your computer and use it in GitHub Desktop.

Select an option

Save teopost/e642af022485ffa83bf6930dad8e63b7 to your computer and use it in GitHub Desktop.
List Oracle slow query
/* https://stackoverflow.com/questions/148648/oracle-is-there-a-tool-to-trace-queries-like-profiler-for-sql-server */
SELECT
S.LAST_ACTIVE_TIME,
S.MODULE,
S.SQL_FULLTEXT,
S.SQL_PROFILE,
S.EXECUTIONS,
S.LAST_LOAD_TIME,
S.PARSING_USER_ID,
S.SERVICE
FROM
SYS.V_$SQL S,
SYS.ALL_USERS U
WHERE
S.PARSING_USER_ID=U.USER_ID
AND UPPER(U.USERNAME) IN ('oracle user name here')
ORDER BY TO_DATE(S.LAST_LOAD_TIME, 'YYYY-MM-DD/HH24:MI:SS') desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment