Sql-server – Table Corruption Error

corruptionsql serversql-server-2008-r2

I have a problem with my SQL Server database. Today I opened it and saw an error – SQL Server Table Corruption Error.

I don't know the reason for this error. I applied SQL Server Management Studio, but it couldn't completely restore my database.

Does someone know methods of repairing SQL Server databases?

Best Answer

Does the database open and you just can't view a single table, or are you unable to browse your database at all? Are other databases on the server affected, or just one? What's the current database status - offline, suspect, or something else? Each can mean different steps to correct or repair the issue.

Also, if you've got a backup handy, you'll want to keep it nearby in case you can't repair the corruption that caused this problem.

If you can open the database, to start you'll want to scan it with DBCC and see if anything obvious comes up:

DBCC CHECKDB ('YourDatabase') WITH NO_INFOMSGS

From there, deal with the error messages or warnings that you see - it should provide enough detail that you're able to search for the specific issues (or update your question to include those details so that we can help you more directly).

SqlMag has a great series on corruption, what it is, and how to respond to it, starting here:

http://sqlmag.com/blog/sql-server-database-corruption-part-i-what-corruption

Jump ahead to section 9 if you want to see their suggestions for fixing it, but be sure you understand what you're dealing with before you take any action.