Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 How to recover data from corrupt SQL database?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Lincolnburrows
Yak Posting Veteran

52 Posts

Posted - 09/29/2014 :  06:33:47  Show Profile  Reply with Quote
We had several power outages and server rebooted couple times which seemed to cause issues with one of the databases. We tried detaching at attaching database again but it looks like database is corrupted and we’re getting the
Msg 5172, Level 16, State 15, Line 1
Claiming that database header is invalid. Is there anything we can to do repair database or extract data from MDF file? We do have a backup but it’s like 2 weeks old and doesn’t contain all data.

MichaelJSQL
Constraint Violating Yak Guru

252 Posts

Posted - 09/29/2014 :  07:15:54  Show Profile  Reply with Quote
Try the following:

http://www.sqlskills.com/blogs/paul/creating-detaching-re-attaching-and-fixing-a-suspect-database/
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
38200 Posts

Posted - 09/29/2014 :  12:45:49  Show Profile  Visit tkizer's Homepage  Reply with Quote
http://dba.stackexchange.com/questions/39359/how-to-recover-data-from-corrupted-sql-server-database

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

prett
Posting Yak Master

USA
212 Posts

Posted - 09/29/2014 :  23:04:33  Show Profile  Visit prett's Homepage  Reply with Quote
Create a Test Database: As you have said that there is no any updated backup of database then it is the time to create a test database with the same database & size.

Steps to Start SQL server with test database:
1. Create a test database with same name & size.
2. Shutdown SQL server database.
3. Swap-in database files.
4. Now restart your SQL server database.

Your database comes up in Suspect Mode. You can export all the data in a new database or rebuild the transaction log.

Run DBCC CHECKDB with repair_allow_data_loss.

Bear in mind that you will lose some amount of data.

Note: If you still get error message then I suggest you to call MS SQL server support team or try any 3rd party SQL repair program.

http://www.stellarphoenixrecovery.com/software-for-sql.php

Waiting for solution is not a most ideal way when your business is down.
Go to Top of Page

bakk
Starting Member

12 Posts

Posted - 11/24/2014 :  06:07:18  Show Profile  Reply with Quote
It is quite difficult to recover data/records form corrupt MDF file if corruption level is too high but still you can give a try by executing DBCC statements. It includes CHECKDB and DBREPAIR statements, explained well in unspammed

Along with data, it also restores database objects.
Go to Top of Page

francesreid
Starting Member

USA
5 Posts

Posted - 10/27/2015 :  02:18:01  Show Profile  Reply with Quote
Hello everybody,
Corruption can happen at any time and reasons are also many for such corruption. Various reasons is seen like automatic system shutdown, virus attack etc and many more. But nothing to get irritate as ways are there to solve such issues. It will be better that you use some software easily available in market or online and just solve the issue.

Good luck..
Go to Top of Page

Houssine
Starting Member

USA
15 Posts

Posted - 02/16/2016 :  02:34:26  Show Profile  Reply with Quote
Microsoft SQL Server Management Studio can hep you repair MDF database if it is tagged as suspected. There are few database console commands aka DBCC which can be used to fix corrupt MDF database. DBCC DBREPAIR and DBCC CHECKDB are two commands which you can try with Microsoft SQL Server Management Studio. Read this blog post for more information Repair SQL Database using SQL Server Management Studio | N. Sem's Blog

You can also try a third-party professional tool to repair corrupt MDF database and to recover data from it. Download free demo version of SQL Database Recovery software that supports MDF files created in Microsoft SQL Server 2000, 2005, 2008, 2012 and 2014. It can restore your maximum possible data items which include system tables, user tables, triggers, indexes, keys, constraints, rules, defaults, etc.

For more information, visit www.data-recovery-solutions.com/sql-database-recovery.html

Thanks and best regards.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000