How can I get the sitecore databases path on the file system?

From time to time, as a developer, we need to attach sitecore databases to SQL Server for many reasons like starting on a new project, or having to unlock the read-only permissions from it on the first time, etc.

I’m not sure about you but I like to have them all in the same folder so I know where all my projects databases are. How can one find what is the path on the file system to all your sitecore databases?

It’s easy.

1- Open Sql Server Management Studio and login with your credentials:

sqlmanagementstudio

2- Create a new query and execute the following sql script:

SELECT name, physical_name AS current_file_location FROM sys.master_files
WHERE name like ‘%sitecore%’

you will get a result set of all your databases that have the string “sitecore” in it:

sqlscript

Also you can use the same script to get all databases(Sitecore or non-Sitecore ones) by just removing the clause WHERE from the sql statement:

SELECT name, physical_name AS current_file_location FROM sys.master_files

Hope you liked it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s