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

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 How to recover data from corrupt SQL database?

Author  Topic 

Lincolnburrows
Yak Posting Veteran

52 Posts

Posted - 2014-09-29 : 06:33:47
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 - 2014-09-29 : 07:15:54
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

38200 Posts

Posted - 2014-09-29 : 12:45:49
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

212 Posts

Posted - 2014-09-29 : 23:04:33
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 - 2014-11-24 : 06:07:18
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

5 Posts

Posted - 2015-10-27 : 02:18:01
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

15 Posts

Posted - 2016-02-16 : 02:34:26
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
   

- Advertisement -