SQL server

Checking Database consistency.

There are times when troubleshooting issues where the application cannot connect to the DB: I log into the server and  everything seems fine, from the DB side.  In the intensity of troubleshooting, suggestions from users may fly like: how do we know if the DB is not corrupt.

This is where DBCC comes in. DBCC stands for Database Consistency Check and it is a quick way to assure users that the DB is functional. The first thing I do is a DBCC CHECKDB (‘db_name’) with ESTIMATEONLY. ESTIMATEONLY will show you how much space in tempdb is needed for the DBCC check. I also use this info to roughly interpret how long the DBCC check will take.

The next step is to do a DBCC CHECKDB (‘db_name’) with NO_INFOMSGS. This will do the consistency check and only return some summarized information. If the check says there were no consistency errors, then I can confidently report back to the users and let them know that the DB is fine.


Thinking about someting? Leave a Reply...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s