| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: so, what is the right way to count tablespace free space
Thanks for replies,
I went to see if Tom Kyte had anything similar and ... his version of
that was:
from dba_tablespaces where tablespace_name = b.tablespace_name) || nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKOWN')) name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0) used,
nvl(kbytes_free,0) free,
round(((kbytes_alloc-nvl(kbytes_free,0))/kbytes_alloc)*100)
pct_used,
round((100 -
((kbytes_alloc-nvl(kbytes_free,0))/kbytes_alloc)*100),3) pct_free,
nvl(largest,0) largest,
nvl(kbytes_max,kbytes_alloc) Max_Size,
round(decode( kbytes_max, 0, 0,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_data_files
group by tablespace_name
union all
select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_temp_files
group by tablespace_name )b
Eugene Received on Fri May 20 2005 - 15:30:23 CDT
![]() |
![]() |