top of page

SQL Server - Where do my SQL Database files reside?

Writer: rajendra guptarajendra gupta

Suppose you have multiple disks and databases. You might have a question where do my database files reside? The below script gives the directory of each database file.

(MDF\LDF\NDF) using the sys.master_files and sys.dm_os_volume_stats.


select name, volume_mount_point, logical_volume_name, 
file_system_type, physical_name, type_desc, state_desc
FROMsys.master_files ASf
CROSSAPPLY sys.dm_os_volume_stats(f.database_id, f.file_id);



1 comentario


Miembro desconocido
31 mar 2023

Hey Raj, saw an article you wrote about filestream on sql server. If I don't have the files in the directory, can I recover them by restoring filestream table?

Me gusta
bottom of page