728x90
SELECT a.[NAME] as '파일 그룹명'
, b.size*8 /1024 as 'PhysicalSize (MB)'
,(b.Size - sum(total_pages))*8/1024 as 'UnAllocationSize (MB) '
, sum(total_pages) * 8 /1024 as 'TotalAllocation (MB)'
, sum(used_pages)*8 /1024 as 'UsedAllocation (MB)'
, sum(data_pages) *8/1024 as 'DataSize (MB)'
, sum(total_pages-used_pages)*8/1024 as 'FreeSize (MB)'
FROM SYS.filegroups a with (nolock)
INNER JOIN ( SELECT data_space_id, sum(size) as 'size'
FROM Sys.database_files with(nolock)
GROUP BY data_space_id
) b
ON a.data_space_id = b.data_space_id
INNER JOIN SYS.allocation_units c with(nolock)
ON a.data_space_id = c.data_space_id
GROUP BY a.name, b.Size
ORDER BY 1, 2
728x90
'DataBase > MSSQL' 카테고리의 다른 글
[MSSQL] DBCC SHRINKFILE - DB 데이터/로그 파일 축소하기 - 2편 (0) | 2022.05.03 |
---|---|
[MSSQL] DBCC SHRINKFILE - DB 데이터/로그 파일 축소하기 - 1편 (0) | 2022.05.03 |
[MSSQL] 제약조건(CONSTRAINT)이란 ? (0) | 2022.04.20 |
[MSSQL] 테이블 컬럼 추가, 수정, 삭제 ALTER TABLE (0) | 2022.04.15 |
[MSSQL] 데이터베이스 파일그룹 정리 (0) | 2022.02.18 |