ORACLE查看所有表空间

直接SQL/PLUS运行:
select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as 总块数,
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
(dfs.freespace / dbf.totalspace) * 100 "空闲比例"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)

结果:
TABLESPACE_NAME                   总量(M)     总块数 剩余总量(M)   剩余块数   空闲比例
------------------------------ ---------- ---------- ----------- ---------- ----------
UNDOTBS1                               30       3840     20.6875       2648 68.9583333
SYSAUX                                260      33280     12.5625       1608 4.83173076
USERS                                   5        640      1.4375        184      28.75
SYSTEM                                480      61440        3.75        480    0.78125
EXAMPLE                               100      12800     22.3125       2856    22.3125

猜你喜欢

转载自newerdragon.iteye.com/blog/1672586