Posts

Showing posts from June, 2022

Oracle DB: find Session ID/ SQL ID/ SQL Statement Using OS Process ID

  How to find Session ID/ SQL ID/ SQL Statement Using OS Process ID 1. It will show you the basic Session Information. SELECT P.SPID OS_PROCESS_ID,       S.SID SESSION_ID,       S.SERIAL#,       S.USERNAME,       S.STATUS,       S.LAST_CALL_ET,       P.PROGRAM,       P.TERMINAL,       LOGON_TIME,       MODULE,       S.OSUSER  FROM GV$PROCESS P, GV$SESSION S WHERE S.PADDR = P.ADDR AND S.INST_ID=P.INST_ID AND P.SPID=&Process_ID ORDER BY S.INST_ID; 2. It Will Show You the SQL ID which SQL Statements currently Executing.  SELECT S.SQL_ID   FROM GV$PROCESS P, GV$SESSION S  WHERE S.PADDR = P.ADDR  AND S.INST_ID=P.INST_ID  AND  P.SPID=&Process_ID  ORDER BY S.INST_ID; 3. It Will Show You the SQL Statements Details which SQL Statements are currently Running. ...