views:

528

answers:

1

I just recently changed out all my hard drives and in the process of setting up some projects again I noticed that the database file I was backing up was actually the wrong file as it only contains 30% of the database that I had running. I have my old drives and all the data should be intact but I've been unable to actually locate the correct database file...

Is there any way that I can read the physical file location from the dead SQL Server?

+2  A: 

get the master database from the old SQL Server instance and attach it to the new system, or restore a backup of the master database, so you can query it. (just dont overwrite/replace the live system's master db!)

SELECT [Name], FileName FROM sysdatabases

will get you a list of the databases on that server, and the full file paths.

Anthony
Sound approach but I'm having a bit of trouble - exactly which database am I supposed to attach? I've tried attaching the master.mdf but running the query still returns information from the new database.How do I access the sysdata from the old server?
cralexns
@cralexns - You need to attach the old master.mdf and mastlog.ldf to the new server under a different name. Then switch into that directory and execute the query above.
Sean Carpenter
I've tried doing that a few times now, it just keeps telling me "Invalid object name 'sysdatabases'."
cralexns
Ended up just booting on the old OS in a Hyper-V instance. Thanks though!
cralexns