📜  oracle 撤消表空间模式 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:05.051000             🧑  作者: Mango

代码示例1
-- 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);