Thursday, November 7, 2013

How to find path of database data files and log files in SQL Server

In this post, We will learn about different technique to find path of data files and log files on SQL Server. Let’s go through one by one of them.

The first technique, We are going to use is very simple way to finding file path for database. But with this you can find path for one database only. It’s very simple, Select database on object explorer and right click and select properties.


HowToSelectDatabaseFilePathSQLServer1

Now once you click on properties a dialog box appear like following. Select files and go to path column it will show path of database data files and log files.

HowToSelectDatabaseFilePathSQLServer2
Now we will learn another technique where we can find database data file and log file path from query. Below is query for that.

SELECT name, physical_name FROM sys.master_files where database_id= db_id('blog')

Now once you run this query it will load result like following.

HowToSelectDatabaseFilePathSQLServer3


That’s it you can find you database file path very easily. You can use above query to find files path for multiple databases also without using where clause. Hope you like it. Stay tuned for more.
Share:

0 comments:

Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews