Display all data files for all databases with size and growth info
SQL Code:
SELECT d.name AS 'Database',
d.database_id,
SF.fileid,
SF.name AS 'LogicalFileName',
CASE SF.status & 0x100000
WHEN 1048576 THEN 'Percentage'
WHEN 0 THEN 'MB'
END AS 'FileGrowthOption',
Growth AS GrowthUnit,
ROUND(((CAST(Size AS FLOAT)*8)/1024)/1024,2) [SizeGB], -- Convert 8k pages to GB
Maxsize,
filename AS PhysicalFileName
FROM Master.SYS.SYSALTFILES SF
Join Master.SYS.Databases d on sf.fileid = d.database_id
Order by d.name
Output:
Related Article:
- Retrieve information on backup and restore operations in SQL Server
- Return list of SQL Agent jobs with schedule information in SQL Server
- Count the Number of Tables in a Database in SQL Server
- Retrieve List of all Stored Procedures in SQL Server
- Display all data files for all databases with size and growth info in SQL Server
- Get all schemas, tables, columns and indexes in SQL Server
- Retrieve all Table detail from Known Column in SQL Server
- Get the list of all databases on a server in SQL Server
- Show Size of All Tables in Current Database in SQL Server
No comments:
Post a Comment