SQL SERVER – 5 Don’ts When Database Corruption is Detected

Here is an email I received about database corruption and that has lead me to write this quick blog post about database corruption.

“Hi Pinal,

We learned that our database got corrupted. Once we learned this, we immediately ran CHECKDB with Repair option and now we are not sure what is happening. We are not able to access our database at all.

What should I do?”

Well, this is just a one message, but quite often I get similar messages. With the information provided in the email, one can’t move forward so they had to engage me in the consultation and we eventually recovered their database. However, during the consultation, I realized that they had done a quite a lot of attempts to recover the database before they reached out to me. Honestly, instead of doing all the efforts if they would have reached out to me without any changes to their system, I would have helped them faster.

Solarwinds

During this database corruption recovery engagement, I realized that I should write this blog post where I will write what one should not do when they detect database corruption.

SQL SERVER - 5 Don'ts When Database Corruption is Detected databasecorruption1-800x433

Don’t Shutdown SQL Server

When the database corruption is detected, the very first reaction of users is to shut down the SQL Server. The most popular argument which I hear is that they want to shutdown SQL Server to prevent the further corruption of the database. This is indeed a good intent, but it is not necessarily the best suggestion. There are enough cases where I have seen database is not able to come back up after it was shut down. You can render your database in an inconsistent state if the database recovery is going on.

Don’t Restart SQL Server

We all have habits when something does not work consistently we restart it. It may be our phone, computer, network or our sometimes I have seen people applying this to their vehicles too. This does not apply for corrupted database on SQL Server. There are zero chances that your corruption will be recovered when you restart your SQL Server. You may end up with some other problems when you restart without understanding what is going on behind the scene.

Don’t Upgrade Your SQL Server

Before I write I must admin that in my career, I have only heard this once so far. However, there are chances that many might have thought about this one, or have done in the past but never shared the story. One of my customers tried to upgrade their server when they faced corruption. They thought that by upgrading to the latest version of SQL Server, they may get rid of the corruption as SQL SErver now might know how to handle corruption better in the next version of SQL Server. Honestly, this is not the route you want to go when you are facing corruption situation.

Repairing Corrupted Database

You should consider the CHECKDB option to repair eventually if your all the other efforts fail. In the most cases without understanding what actually this option do, many DBA end up loosing their data. One of my customers once allowed repair with data loses on their database and their database was not showing any errors with CHECKDB. However, their application did not work as it missed the important table in the database.

Use this option once, you are absolutely sure that you have no other route left besides repairing the corrupted database.

Third Party Tools

There are lots of third party tools available, which claim that they can repair your database. There are cases where I have seen them working perfectly fine. They often attract customers by showing a part of the database during trial, but when the user tries to attempt to recover the database after purchasing the full license they often do not produce desired results.

Instead of downloading any third party tool and risking your database, I suggest you reach out to an expert consultant first and under their guidance, use the tool. I also keep a list of good tools with me. If you want to know more about it, you may reach out to me directly at my email address.

Summary

Well, above the list was was about things which you should not do when you encounter database corruptions. You must plan your disaster recovery situation such a way that when you encounter such situation you exactly know what you would do and how you can recover.

If you are going to reach out to me for database, corruption, I am going to ask you one simple question – “How old is your last good full database backup?” Make sure that you have answer of this question in your email and I will be happy to help.

Here are two related blog posts:

Reference: Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, , , ,
Previous Post
SQL SERVER – How to Delete a Single Table From SQL Server Backup File (.bak)
Next Post
SQL SERVER – RETAINDAYS Does Not Delete Backup After x Days

Related Posts

1 Comment. Leave new

  • Hi Pinal

    Issue is one of my user database got corrupted, and the final backup was done around Feb 2018 and that too was corrupted. please help me out with solution.

    Reply

Leave a Reply

Menu