Find Current Location of Data and Log File of All the Databas

We restored the database in the client development server for out client development and testing purpose.This time we need to take back and restore it in the client production machine. while am doing this we are unable to restore it. Later we found in client development machine client move the ‘.mdf and .ldf’ to different folder.

SELECT name, physical_name AS current_file_location
FROM sys.master_files

The above SQL script helped us to sort out the issue. We can also use this same script to clean up the junk database folder.


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: