8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Script: df_free_space.sql
( Download Script )
-- ----------------------------------------------------------------------------------- -- File Name : https://oracle-base.com/dba/monitoring/df_free_space.sql -- Author : Tim Hall -- Description : Displays free space information about datafiles. -- Requirements : Access to the V$ views. -- Call Syntax : @df_free_space.sql -- Last Modified: 17-AUG-2005 -- ----------------------------------------------------------------------------------- SET LINESIZE 120 COLUMN file_name FORMAT A60 SELECT a.file_name, ROUND(a.bytes/1024/1024) AS size_mb, ROUND(a.maxbytes/1024/1024) AS maxsize_mb, ROUND(b.free_bytes/1024/1024) AS free_mb, ROUND((a.maxbytes-a.bytes)/1024/1024) AS growth_mb, 100 - ROUND(((b.free_bytes+a.growth)/a.maxbytes) * 100) AS pct_used FROM (SELECT file_name, file_id, bytes, GREATEST(bytes,maxbytes) AS maxbytes, GREATEST(bytes,maxbytes)-bytes AS growth FROM dba_data_files) a, (SELeCT file_id, SUM(bytes) AS free_bytes FROM dba_free_space GROUP BY file_id) b WHERE a.file_id = b.file_id ORDER BY file_name;