Skip to content

Instantly share code, notes, and snippets.

@ohforest
Forked from katjunior/oracle_sql_text_spid.sql
Created July 15, 2022 10:54
Show Gist options
  • Save ohforest/4b56dbbe90288fb2aa860e1e77095687 to your computer and use it in GitHub Desktop.
Save ohforest/4b56dbbe90288fb2aa860e1e77095687 to your computer and use it in GitHub Desktop.
Oracle - Select Sql Text from System Process ID
select s.sql_text,s.sql_fulltext from v$sql s
where sql_id in (SELECT A.SQL_ID FROM V$SESSION A,V$PROCESS B
WHERE A.PADDR=B.ADDR AND B.SPID='6495')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment