ITPub博客

首页 > 数据库 > Oracle > 查看表空间使用空间情况

查看表空间使用空间情况

原创 Oracle 作者:leon830216 时间:2014-03-01 19:08:50 0 删除 编辑
column tbs_name format a30
select
    a.tablespace_name TBS_NAME,
    round(b.total/1024/1024) "TOTAL(M)",
    round((b.total-a.free)/1024/1024) "USED(M)",
    round(a.free/1024/1024) "FREE(M)",
    round((b.total-a.free)/b.total,4)*100 "USED(%)"
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
union all
select
    tablespace_name TBS_NAME,
    sum(bytes)/1024/1024 "TOTAL(M)",
    null "USED(M)",
    null "FREE(M)",
    null "USED(%)"
from
    dba_temp_files
group by tablespace_name
order by "USED(%)" desc
/

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22558114/viewspace-1097801/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: show_space2
请登录后发表评论 登录
全部评论

注册时间:2009-09-18

  • 博文量
    160
  • 访问量
    380449