Consulting

Results 1 to 7 of 7

Thread: Recovering a SQL Server 2005 Database from a Corrupt .mdf

  1. #1

    Recovering a SQL Server 2005 Database from a Corrupt .mdf

    I've searched around and to no avail have found a solution. Before I drop the $$$ on M$ support, I would like some advice from fellow EE experts.
    Situation:
    -Working SQL server directory was deleted, no backups of said directory or full database backups (oh joy!),
    -It's imperative that all avenues of recovery are attempted to get the data back (even if that requires $$$$$$$).
    Any advice? Has anyone been in this situation before with any luck using M$ support? Or maybe a different company?
    Please spare me the "Death Wish Maintenance Plan", "Should have had nightly backups" mumbo jumbo because yes, I too feel this situation could have been avoided but I was called in after the fact to help rectify the problem.
    Thanks.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Almost all OS'es do not wipe the hard drive when deleting files. On a Hard drive, Directory locations are stored in a File Allocation Table and a special bit is set to "Not used any longer." There are a ton of free hard drive editors online, I think Hirems has one, that will let you read the File Allocation Table and reset that bit. The Directory names are in Ascii, so you can search for that name.

    I do hope that the server was powered down as soon as the error was noticed. If it is still active it will overwrite the directory location and all data will be lost with out spending big bucks to possibly recover some of it. The longer it runs the more data is overwritten and the cost to recover increases logarithmically.

    Make a pot of strong coffee and
    https://duckduckgo.com/?q=recover+ha...ve+data&t=ffsb
    https://duckduckgo.com/?q=recover+de...ve+data&t=ffsb
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Newbie
    Joined
    Jan 2016
    Posts
    1
    Location
    Hi,AndorLakatos

    When a MDF database file is corrupt, you can first use the SQL Server build-in command DBCC CheckDB and CheckTable to repair it, This is the recommended solution which you should try first.

    If the corruption is severe and the above commands do not work, then you may try some third party tools to scan and recover the data from your corrupted MDF and NDF database files. like DataNumen SQL Recovery.

    Most of those tools provide a free demo so you can try before you purchase.

    Hope this will help. Good luck!

  4. #4
    Give me some info...
    Whats the size of database?
    Do you fave also the ldf file?
    If you attach the mdf what error message you get?
    Maybe this post will help you?
    https://community.office365.com/en-us/f/172/t/266070

  5. #5
    SIze of databases: ~3.5GB
    Yes I have the LDF's.
    If I attach the MDF I get:
    ------------------------------
    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------

    C:\Location To The MDF\DATABASE.mdf is not a primary database file. (Microsoft SQL Server, Error: 5171)

  6. #6
    Last time one of my customers had a similar situation (but not as bad as yours...). They had one of the pages in their database corrupted. I'm afraid you can't be sure you'll get any help from MS in this case (in my scenario they said this is DBA's fault since he did not check database integrity on a regular basis...). There are companies in practically every single country that specialize in advanced file or database recovery (usually with their own tools). I would rather try it this way than count on the MS support here.

    PS. I managed to recover from the crisis with my customer's database by scripting the database objects one by one ;-) And often helps me SQL Server Recovery Toolbox. You can try a free version.)
    Last edited by RuneLassen; 01-28-2016 at 09:55 AM. Reason: link

  7. #7
    Thanks guys!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •