欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

oracle查询undo表空间使用率,检查Undo表空间使用情况

发布时间:2023/12/9 53 豆豆
生活随笔 收集整理的这篇文章主要介绍了 oracle查询undo表空间使用率,检查Undo表空间使用情况 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

######脚本###########

SELECT TABLESPACE_NAME, ROUND ( (USED / TOTAL_SIZE) * 100, 2) USED_RATE

FROM (SELECT A.TABLESPACE_NAME, TOTAL_SIZE, USED

FROM (  SELECT TABLESPACE_NAME,

ROUND (SUM (BYTES) / 1024 / 1024 / 1024, 2) TOTAL_SIZE

FROM DBA_DATA_FILES

WHERE 1 = 1 AND TABLESPACE_NAME LIKE 'UNDOTBS%'

GROUP BY TABLESPACE_NAME) A,

(  SELECT TABLESPACE_NAME,

ROUND (SUM (BYTES) / 1024 / 1024 / 1024, 2) USED

FROM DBA_UNDO_EXTENTS

WHERE 1 = 1 AND STATUS = 'UNEXPIRED'

GROUP BY TABLESPACE_NAME) B

WHERE 1 = 1 AND A.TABLESPACE_NAME = B.TABLESPACE_NAME);

------------------------------------------------------------------------------------------------------------------

The Expired blocks will be reused and hence this should be counted as 'available' space in the Undo segment.

You can check the status of the undo extents via the SQLs below.

select sum(bytes /(1024*1024)) from dba_undo_extents where status='EXPIRED';

select sum(bytes /(1024*1024)) from dba_undo_extents where status='ACTIVE';

select sum(bytes /(1024*1024)) from dba_undo_extents where status='UNEXPIRED';

For more detailed information, please refer to:

Master Note: High Undo Space Usage ( Doc ID 1578639.1 )

Above all, if the undo status is Expired, you can safely ignore the undo usage, as the space will be reused automatically.

总结

以上是生活随笔为你收集整理的oracle查询undo表空间使用率,检查Undo表空间使用情况的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。