Thursday 11 February 2021

Query to find tablespace total and free space.

This document describes how to find the total allocated size and available free size of tablespaces in the database.

Find the tablespace size using below query.

SELECT /* + RULE */
df.tablespace_name AS "Tablespace"
,df.bytes / (1024 * 1024 ) AS "Total Size in (MB)"
,Trunc(fs.bytes / (1024 * 1024 )) AS "Total Free Size in (MB)"
FROM (
SELECT tablespace_name
,Sum(bytes) AS bytes
FROM dba_free_space
GROUP BY tablespace_name
) fs
,(
SELECT tablespace_name
,SUM(bytes) AS bytes
FROM dba_data_files
GROUP BY tablespace_name
) df
WHERE fs.tablespace_name = df.tablespace_name

ORDER BY 3 DESC;






Thanks for going through the post..........

No comments:

Post a Comment