Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

oracle undo usage by session

-- UNDO tablespace usage per user / session
SELECT s.SID, s.USERNAME, round(sum(ss.VALUE) / 1e6, 2) AS UNDO_SIZE_MB,
       sql.ELAPSED_TIME, sql.SQL_TEXT
FROM V$SESSTAT ss JOIN V$SESSION s ON s.SID = ss.SID
     JOIN V$STATNAME STAT ON STAT.STATISTIC# = ss.STATISTIC#
     LEFT JOIN V$SQLAREA sql 
     	ON s.SQL_ADDRESS = sql.ADDRESS AND s.SQL_HASH_VALUE = sql.HASH_VALUE
WHERE STAT.NAME = 'undo change vector size' AND s.TYPE <> 'BACKGROUND' 
  AND s.USERNAME IS NOT NULL AND ss.VALUE >= 0.01 * 1e6
GROUP BY s.SID, s.USERNAME, sql.ELAPSED_TIME, sql.SQL_TEXT
ORDER BY s.USERNAME, round(sum(ss.VALUE) / 1e6, 2);
Source by dba.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #oracle #undo #usage #session
ADD COMMENT
Topic
Name
5+7 =