SELECT tablespace_name 表空间名, round(SUM(bytes) / 1000 / 1000 / 1000, 2) alloc_bytes, round(SUM(maxbytes) / 1000 / 1000 / 1000, 2) maxbytes FROM dba_data_files GROUP BY tablespace_name; SELECT tablespace_name 表空间名, round(SUM(nvl(bytes, 1)) / 1000 / 1000 / 1000, 2) free_space FROM DBA_FREE_SPACE GROUP BY tablespace_name; SELECT tablespace_name 表空间名, round(SUM(bytes) / 1000 / 1000 / 1000, 2) 占用, round(SUM(maxbytes) / 1000 / 1000 / 1000, 2) 最大 FROM dba_data_files GROUP BY tablespace_name; SELECT tablespace_name 表空间名, round(SUM(nvl(bytes, 1)) / 1000 / 1000 / 1000, 2) 空闲 FROM DBA_FREE_SPACE GROUP BY tablespace_name; SELECT a.tablespace_name, round(a.bytes/1024/1024/1024,2) 总空间, round(b.bytes/1024/1024/1024,2) 使用空间, round(c.bytes/1024/1024/1024,2) 空闲空间, (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(+); SELECT a.tablespace_name 表空间名, round(a.bytes/1024/1024/1024,2) 总空间, round(b.bytes/1024/1024/1024,2) 使用空间, round(c.bytes/1024/1024/1024,2) 空闲空间, d.maxbytes 最大空间, (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, (SELECT tablespace_name,round(SUM(maxbytes) / 1024 / 1024 / 1024, 2) maxbytes FROM dba_data_files GROUP BY tablespace_name) d WHERE a.tablespace_name = b.tablespace_name AND a.tablespace_name = c.tablespace_name(+) AND a.tablespace_name = d.tablespace_name; select a.tablespace_name,total,free,total-free used from (select tablespace_name,sum(bytes)/1024/1024/1024 total from dba_data_files group by tablespace_name) a, ( select tablespace_name,sum(bytes)/1024/1024/1024 free from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name;
标签:1024,name,查看,占用,bytes,tablespace,oracle,round,1000 From: https://www.cnblogs.com/Jiu-er/p/17275700.html