top of page

Find SQL Server Database Data and Log File Size in GB

  • Writer: Kunal Ranpura
    Kunal Ranpura
  • Jul 29, 2019
  • 1 min read

SELECT DB_NAME([database_id])AS [Database Name],

[file_id], name, physical_name, type_desc, state_desc,

CONVERT( bigint, size/128000.0) AS [Total Size in GB]

FROM sys.master_files

ORDER BY DB_NAME([database_id]) OPTION (RECOMPILE);


-- Things to look at:

-- Are data files and log files on different drives?

-- Is everything on the C: drive?

-- Is TempDB on dedicated drives?

-- Is there only one TempDB data file?

-- Are all of the TempDB data files the same size?

-- Are there multiple data files for user databases?

Recent Posts

See All
SQL Server Profiler Trace

--Import multiple trace file in sql Table. --All the rollover files will be automatically imported --provide number tracefile to capture...

 
 
 
Find All Primary Key in SQL Server

select schema_name(tab.schema_id) as [schema_name], pk.[name] as pk_name, substring(column_names, 1, len(column_names)-1) as [columns],...

 
 
 
bottom of page