HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Where is the information about what files each database stored for SQL Server 2008 R2

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storedtheeachwhat2008sqlwheredatabasefilesabout

Problem

I need to find where SQL Server 2008 R2 stores what files back each database. The kicker is that the server has completely crashed (hardware failure). I've managed to recover all the .mdf/.ldf files.

I need to get a single database up and running on another server asap, but whoever set the server up originally didn't match the database names to the file names very well, so I need to somehow extract the mapping between the two without going through a full restore of SQL Server, i.e. I need to know the names of the files for database XXXXX as it was attached to SQL Server.

Is this possible? Was thinking about attached the recovered master database onto another SQL Server instance, but I cannot seem to find any information about data files in another master database, so it might be a waste of time.

Thanks

Solution

SQL Server maintains this in sys.master_files, after you have restored the master database

When SQL Server starts up, you'll see a lot of suspect databases.

You can attach the MDFs and LDFs using the info in sys.master_files

Context

StackExchange Database Administrators Q#7207, answer score: 5

Revisions (0)

No revisions yet.