tanelpoder / tpt-oracle

Tanel Poder's Performance & Troubleshooting Tools for Oracle Databases
https://tanelpoder.com
Other
657 stars 312 forks source link

df and dfm #3

Open baobao219 opened 5 years ago

baobao219 commented 5 years ago

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)/(102410241024)) 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)/(102410241024)) gb, max(autoextensible) ext from dba_data_files group by tablespace_name union all select tablespace_name, trunc(sum(bytes)/(10241024*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;

ignacioruiz commented 4 years ago

Above may require some translation: "df and dfm cannot temporarily use the space usage information of the table space, and always display 100%. It is recommended that the script be modified as follows:"