View table space usage

View tablespace usage
Method 1:
SELECT a.tablespace_name,
a.bytes/1024/1024 total, b.bytes
/1024/1024 used,
c.bytes/1024/1024 free,
(b.bytes * 100) / a. bytes "% USED ",
(c.bytes * 100) / a.bytes "% FREE "
FROM sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free c
WHERE a.tablespace_name = b.tablespace_name
AND a.tablespace_name = c.tablespace_name;

Method 2:
SELECT a.tablespace_name "tablespace name",
total "tablespace size",
free "tablespace remaining size",
(total - free) "tablespace usage size",
total / (1024 * 1024 * 1024) "table space size (G)",
free / (1024 * 1024 * 1024) "table space remaining size (G)",
(total - free) / (1024 * 1024 * 1024) "Table space usage size (G)",
round((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327048581&siteId=291194637