Free Information Technology Magazines and eBooks

Thursday, April 09, 2009

SQL Server: Script to List the physical location of Data and Log files of each database

As SQL administrator, part of our preventive maintenance is knowing the physical location of all databases for us to properly manage the available disk spaces needed for each database. The hassle of going through the properties of each database is too tedious and slow. But ofcourse there's always an easier way. To retrieve all physical location in less than a minute, use the following SQL scripts:


SELECT name, physical_name AS physical_location
FROM sys.master_files


Here's a sample output of the script:

Output of sql script to List the physical location

From the result you can monitor all the physical location of your databases. I hope this short tip can help anyone specially beginners. Until next time!

0 comments: