top of page
Writer's picturerajendra gupta

SQL Server - Where do my SQL Database files reside?

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);



271 views1 comment

Recent Posts

See All

1 bình luận


Thành viên không xác định
31 thg 3, 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?

Thích
bottom of page