Search for your Content

Tuesday, July 5, 2011

Session Query


-- |----------------------------------------------------------------------------|
-- | DATABASE : Oracle                                                          |
-- | FILE     : sess_query_sql.sql                                              |
-- | CLASS    : Session Management                                              |
-- | PURPOSE  : Displays the SQL being run by a given session given the SID.    |
-- | NOTE     : As with any code, ensure to test this script in a development   |
-- |            environment before attempting to run it in production.          |
-- +----------------------------------------------------------------------------+


SET LINESIZE 145
SET PAGESIZE 9999


COLUMN sql_text FORMAT a80


SELECT
    a.sql_text
FROM
    v$sqlarea a
  , v$session s
WHERE
      a.address = s.sql_address
  AND s.sid = &&sid
/

No comments:

Post a Comment