We have a corrupt data on some parts of the database and it can't be fixed by DBCC CHECKDB. Though the data is not important we plan to move the data to a new DB EXCLUDING the corrupt data.
Are there any tools available that can do that?
Technology Tips and News
We have a corrupt data on some parts of the database and it can't be fixed by DBCC CHECKDB. Though the data is not important we plan to move the data to a new DB EXCLUDING the corrupt data.
Are there any tools available that can do that?
Hi Flyod,
Read this link first https://social.msdn.microsoft.com/Forums/sqlserver/en-US/e278d333-b41b-497b-94ca-f4fa68804de2/how-to-repair-a-corrupt-database?forum=sqldisasterrecovery
Do you have any backup's in place for this database. If so restore it using a most recent backup. If you don't have backups in place and if your database is in suspect mode please use the script below that may help
EXEC sp_resetstatus [YourDatabase]; ALTER DATABASE [YourDatabase] SET EMERGENCY DBCC checkdb ([YourDatabase]) ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC DATABASE ([YourDatabase], REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE [YourDatabase] SET MULTI_USER
Also see this link https://semnaitik.wordpress.com/2014/02/22/how-to-repair-corrupted-ms-sql-database-file/
If none of these above solutions work and you still think your data is important. Contact Microsoft Support
Hope this helps
Thanks
Bhanu
The database is working. Technically the database file (.mdf) is not corrupt since it is still working. We only encounter some errors in the data but not all. The commands you just posted cannot fix the problem.Hi Flyod,
Do you have any backup's in place for this database. If so restore it using a most recent backup. If you don't have backups in place and if your database is in suspect mode please use the script below that may help
EXEC sp_resetstatus [YourDatabase]; ALTER DATABASE [YourDatabase] SET EMERGENCY DBCC checkdb ([YourDatabase]) ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC DATABASE ([YourDatabase], REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE [YourDatabase] SET MULTI_USERAlso see this link https://semnaitik.wordpress.com/2014/02/22/how-to-repair-corrupted-ms-sql-database-file/
If none of these above solutions work and you still think your data is important. Contact Microsoft Support
Hope this helps
Thanks
Bhanu
Hi Floyd,
What are the errors that you are getting? If you read my comments clearly, I have only asked you to run those commands only if the database is in suspect mode.
If the errors are data related, I am sorry to say you wouldn't find much help. That should be something that you guys needs to look at. Alternatively contact MS Support
Hope this helps
Ta
Hi Floyd,
What are the errors that you are getting? How can you say that the database is corrupt when you can access the database? If you read my comments clearly, I have only asked you to run those commands only if the database is in suspect mode.
Hi!
I get "Attempt to fetch logical page (1:7590919) in database 11 failed. It belongs to allocation unit 7205794277134336 not to 72057594243899648."
Sorry I miss stated it. Its some of the data on the the database is corrupt not the database itself.
Hi Floyd,
Looks like Page corruption as mentioned in the posts below. See if they help
http://www.sqlhub.com/2011/11/error-fix-msg-605-attempt-to-fetch.html
https://support.microsoft.com/en-us/kb/2015739
Hope this helps
Thanks
Bhanu
We have a corrupt data on some parts of the database and it can't be fixed by DBCC CHECKDB. Though the data is not important we plan to move the data to a new DB EXCLUDING the corrupt data.
Are there any tools available that can do that?
You dont need to run reapir_allow_data_loss if you database is working.
What you can do is take backup of current database if it fails use continue_after_error see BOL for more details about how to use this command.
Now restore it again using continue_after_error. Now you have copy of corrupt database . Create a new database try to script out as much table as you can and move data from it to other database.
If you want to check what pages are corrupt you can run dbcc checkdb