Skip to content

df and dfm #3

Open
Open
@baobao219

Description

@baobao219

df 和dfm 无法临时表空间的空间使用率信息,一直显示%100,建议脚本修改如下
select t.tablespace_name, t.gb "TotalGB", t.gb - nvl(f.gb,0) "UsedGB", nvl(f.gb,0) "FreeGB"
,lpad(ceil((1-nvl(f.gb,0)/decode(t.gb,0,1,t.gb))100)||'%', 6) "% Used", t.ext "Ext",
'|'||rpad(lpad('#',ceil((1-nvl(f.gb,0)/decode(t.gb,0,1,t.gb))20),'#'),20,' ')||'|' "Used"
from (
select tablespace_name, trunc(sum(bytes)/(1024
1024
1024)) gb
from dba_free_space
group by tablespace_name
union all
select tablespace_name, trunc(sum(free_blocks)8192/(102410241024)) gb
from v$sort_segment
group by tablespace_name
) f, (
select tablespace_name, trunc(sum(bytes)/(1024
10241024)) gb, max(autoextensible) ext
from dba_data_files
group by tablespace_name
union all
select tablespace_name, trunc(sum(bytes)/(1024
1024*1024)) gb, max(autoextensible) ext
from dba_temp_files
group by tablespace_name
) t
where t.tablespace_name = f.tablespace_name (+)
order by t.tablespace_name;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions