MS_SQL check data-file size by using script

Data-file size check and get information for all databases on the server :-
==============================================

SELECT      STATS.Volume_Mount_Point AS 'Drive',
            DB_NAME(STATS.Database_ID) AS 'Database Name',
            FILES.[Name] AS 'File Name',
            FILES.[Size] / 128 AS 'File Size',
            ((STATS.Total_Bytes / 1024) / 1024)
            AS 'Drive Capacity (MB)',
            ((STATS.Available_Bytes / 1024) / 1024)
            AS 'Drive Free Space (MB)'
FROM  sys.master_files FILES
CROSS APPLY
            sys.dm_os_volume_stats
            (FILES.database_id, FILES.file_id) STATS

Comments

Popular posts from this blog

SQL Tuning Task Creation ORA-13780: SQL statement does not exist.

Shareplex some commands

ORA-1092 : opitsk aborting process