02 November,2020 by Jack Vamvas
I had a question from a fellow DBA about how to list every file per SQL Server filegroup , and report on the size in MB. This will give them a quick way of checking which file could be creating a capacity issue.
Quite often , alerting is set up to check the whole drive , but won't check every file. So some granular report can identify the file causing a capacity issue
--Return file , size in MB , filegroup
SELECT sdf.name AS [File_Name], sdf.size/128 AS [Size_MB], fg.name AS [FileGroup_Name], sdf.physical_name as [File_physical_name] FROM sys.database_files sdf INNER JOIN sys.filegroups fg ON sdf.data_space_id=fg.data_space_id
Read more on Filegroups
How to create a table in another FILEGROUP using SELECT INTO ...
Moving a Non Clustered Index to another filegroup ...
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |