2011年8月13日土曜日

[管理脚本] 表空间使用空间情况

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
/

0 件のコメント:

コメントを投稿