SQL SERVER – Check Database Integrity for All Databases of Server

Today we will see quick script which will check integrity of all the database of SQL Server.

EXEC sp_msforeachdb 'DBCC CHECKDB(''?'')'

Above script will return you lots of messages in resultset. If there are any errors in resultset they will be displayed in red text. If everything is black text there is no error. Typical output of above script will be like image included in the article.

Image displayed above is only partial image.

Reference : Pinal Dave (http://www.SQLAuthority.com)

About these ads

8 thoughts on “SQL SERVER – Check Database Integrity for All Databases of Server

  1. Hi Pinal,

    Its really a nice script & I am using this in our enviornment. But I need you to kindly explain the results of DBCC CHECKDB.How to read the results of this query.

    Thanks in advance.

    Regards,

    Sanjeev Kumar

    Like

  2. Pls help me……….
    i have design the website in asp.net……..
    but have some problem…..
    I set the question and answers randomly from the sql database….. and also check the result of the question in the database. checking is the problem……….
    When page load occurs every questions are checked before answered…….. i have confused with this……

    thanks in advance

    Like

  3. Pingback: SQL SERVER – Beginning New Weekly Series – Memory Lane – #002 « SQL Server Journey with SQL Authority

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s