Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle undo usage

-- UNDO tablespace current usage / available space
SELECT a.TABLESPACE_NAME, SIZEMB, USAGEMB, (SIZEMB - USAGEMB) AS FREEMB
FROM (SELECT round(sum(BYTES) / 1e6) AS SIZEMB, b.TABLESPACE_NAME
      FROM DBA_DATA_FILES a, DBA_TABLESPACES b
      WHERE a.TABLESPACE_NAME = b.TABLESPACE_NAME AND b.CONTENTS LIKE '%UNDO%'
      GROUP BY b.TABLESPACE_NAME) a,
     (SELECT c.TABLESPACE_NAME, sum(BYTES) / 1e6 AS USAGEMB
      FROM DBA_UNDO_EXTENTS c
      WHERE STATUS <> 'EXPIRED'
      GROUP BY c.TABLESPACE_NAME) b
WHERE a.TABLESPACE_NAME = b.TABLESPACE_NAME;
Comment

oracle undo usage

-- 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);
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql - find in comma separated string of values 
Sql :: change default role snowflake 
Sql :: create database collation 
Sql :: mysql size of table 
Sql :: view t-sql mail configuration 
Sql :: How to convert Varchar to Double in sql? 
Sql :: delete all content in table mysql 
Sql :: postgres database sizes 
Sql :: get ip from phpmyadmin 
Sql :: docker open terminal mysql server 
Sql :: mysql list users 
Sql :: SELECT table_name FROM user_tables; 
Sql :: mysql grant grant option 
Sql :: copy data from one table column to another table column in sql 
Sql :: psql connect as user with password 
Sql :: mysql show attributes of a table 
Sql :: oracle show index columns 
Sql :: postgres add column integer 
Sql :: get server date mysql 
Sql :: limit sqlserver 
Sql :: CONCAT_WS() concat function in mysql 
Sql :: mysql select multiple rows into one column 
Sql :: psql get table data types 
Sql :: how to assign date field for table in mysql 
Sql :: sql compare two tables for differences 
Sql :: add column in sql server 
Sql :: how to change a collumn name in sql 
Sql :: select into temp table 
Sql :: CALCULATING MONTHS BETWEEN TWO DATES IN POSTGRESQL 
Sql :: mysql between 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =