Irreparable Error in Database

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?

July 13th, 2015 9:09pm

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


  • Edited by bhanu_nz 5 hours 45 minutes ago
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2015 9:20pm

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_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.
July 13th, 2015 9:23pm

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



  • Edited by bhanu_nz 5 hours 29 minutes ago
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2015 9:33pm

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.

July 13th, 2015 11:33pm

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

Free Windows Admin Tool Kit Click here and download it now
July 13th, 2015 11:48pm

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

July 14th, 2015 1:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics