Server failed, can I retrieve my database from the my hard disk?

7,563

Solution 1

I would try to copy the database file(s) off that hard drive onto another computer running MS SQL 2008 and see if the file is accessible. It sounds like some Windows files are corrupted but that doesn't mean your database file is. This information might be helpful:

https://stackoverflow.com/questions/6584938/move-sql-server-2008-database-files-to-a-new-folder-location

Solution 2

If you can get the .MDF and .LDF files for the old database off of the old hard drive intact, you should be able to attach them as a new database on the new server. Reference here:

http://msdn.microsoft.com/en-us/library/ms187858.aspx

Let's say your database was named "MyDatabase" and that the files are "MyDatabase_Data.mdf" and "MyDatabase_Log.ldf"

Copy them to a folder on your new server, say "c:\MySQLServer" and then attach them as a new database:

USE master;
GO
CREATE DATABASE MyDatabase 
    ON (FILENAME = 'C:\MySQLServer\MyDatabase_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\MyDatabase_Log.ldf')
    FOR ATTACH;
GO
Share:
7,563

Related videos on Youtube

Alex
Author by

Alex

Updated on September 18, 2022

Comments

  • Alex
    Alex almost 2 years

    I have an old server running Windows Server 2003 R2. Windows got corrupted due to an improper shutdown. I attempted to repair the Windows installation, but it made things worse (it gets to the desktop, but there is no start menu and most of the start menu items are missing). I cannot run any programs and Windows claims that the applications must be reinstalled.

    Anyways, this server is old and we have a newer server that has taken over 90% of the duties of this server except for hosting a database. A backup of the database was used to get it started on the new server, but it is about one day old. Unfortunately, all the inventory data was entered between the last backup and when the server failed and that is a lot of information to re-enter.

    Is there a way to retrieve the database information straight from the hard disk (by plugging it into another computer to read from)? The database was being managed by MS SQL Server 2008. I've use a third party SQL backup tool and MS SQL Server Management on the machine itself and it won't load the application (complains about missing core Windows and .Net files). Re-running the windows setup has been useless resulting in the same gimped desktop.

    • TomTom
      TomTom over 11 years
      Good lesson in taking log backups every 5 minutes, or use log file shipping automatically every 15. You lost a day of work for not taking care of your data - bite it, reenter the data and if necessary hire a pro to set up a proper replication topology.