Friday, May 9, 2008

Query to see the Reserved, Used and Free space of your database

REM: Query to see the Reserved, Used and Free space of your database
REM: NOTE: PLEASE TEST THIS SCRIPT BEFORE USE.
REM: Author will not be responsible for any damage that may be cause by this script.
REM:*****************************************

SELECT r.tablespace_name, reserved_space \"RESERVED_SPACE(MB)\",
reserved_space - free_space \"USED_SPACE(MB)\",
free_space \"FREE_SPACE(MB)\"
FROM (SELECT tablespace_name, SUM (BYTES)
/ (1024 * 1024) reserved_space
FROM dba_data_files
GROUP BY tablespace_name) r,
(SELECT tablespace_name, SUM (BYTES) / (1024 * 1024) free_space
FROM dba_free_space
GROUP BY tablespace_name) f
WHERE r.tablespace_name = f.tablespace_name
ORDER BY r.tablespace_name;

No comments:

Post a Comment

Thanks for you valuable comments !