| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> so, what is the right way to count tablespace free space
Hi all,
You may say: There is tonn of stuff on the web and in Oracle docs, but
the problem with that it that I get different results with each
one(take SYSTEM ts as an example).
Example 1: Result: SYSTEM 97.71% (pct_space)
ROUND(SUM(bytes)/1024/1024) space_used
FROM DBA_EXTENTS
GROUP BY tablespace_name) a,
(SELECT df.tablespace_name,
SUM(ROUND(NVL(fe.maxextend *
4096/1024/1024,df.bytes/1024/1024))) max_size
FROM sys.FILEXT$ fe,
DBA_DATA_FILES df
WHERE fe.FILE#(+) = df.file_id
GROUP BY df.tablespace_name) b
Example 2: Result: SYSTEM 26.63% (pct_space)
Max_Blocks,
Count_Blocks,
Sum_Free_Blocks,
round(100*Sum_Free_Blocks/Sum_Alloc_Blocks,2) AS Pct_Free
from (select Tablespace_Name, SUM(Blocks) Sum_Alloc_Blocks
from DBA_DATA_FILES
group by Tablespace_Name),
(select Tablespace_Name FS_TS_NAME,
MAX(Blocks) AS Max_Blocks,
COUNT(Blocks) AS Count_Blocks,
SUM(Blocks) AS Sum_Free_Blocks
from DBA_FREE_SPACE
group by Tablespace_Name)
Example 3: Result: SYSTEM 2.05% (pct_space)
I'm really confised as what script to use and why are they all produce different results?
Thanks,
Eugene
Received on Fri May 20 2005 - 12:33:58 CDT
![]() |
![]() |