Skip to content

CHECKDB

My CheckDB Script

From time to time I get asked about checkDB, and there are many solutions out there, but I have one that I generally use that is very simple and does the job.

The script below created a stored procedure in the DBHealthHistory database that can be used to check as many databases as you can get through in a specific time interval. Here it is set to 5 minutes, but that usually gets extended for large databases.  If you set the job to daily, and the job doesn’t get through checking all the databases today, it will pick up where it left off and check the rest tomorrow.

 

Depending on the number and size of your databases you may want to run this more than once a day, or for a longer period than the 5 minutes.

Note: the 5 minute limitation is checked before starting the next check, so if you have a database that takes hours to check, that will kick off in the 5 minute interval and run until completion.

 

Read More »My CheckDB Script

DBCC CheckDB and CheckTable doesn’t check In-Memory OLTP.

Special thanks to my friend Theresa Iserman for introducing me to Jos de Bruijn the Senior Program Manager for the In Memory OLTP (Hekaton) project to help get my questions answered at PASS Summit.

So, the Hekaton – In Memory OLTP tables are perhaps one of the most amazing performance improvements to SQL OLTP in a long time. The way that they are managing data with no latches, locks or spinlocks is awesome, and the performance gains are great.

However in a recent session at Pass Summit 2016 with Bob Ward, I followed up with a question on CheckDB and In Memory OLTP tables. Since the data for these are not store in the normal SQL Server data files or even in regular pages. Bob confirmed that CheckDB (and CheckTable) does not check the data associated with the In Memory OLTP tables. I even confirmed this from Books Online in a post called “Transact SQL Constructs Not Supported by In-Memory OLTP” which stated the following:

  • DBCC CHECKDB skips the memory-optimized tables in the database.
  • DBCC CHECKTABLE will fail for memory-optimized tables.

Read More »DBCC CheckDB and CheckTable doesn’t check In-Memory OLTP.

Introducing the DataBase Corruption Challenge (DBCC) – Week 1 Challenge

corruption

Welcome to the DataBase Corruption Challenge, this is an about weekly blog challenge where I will post a corrupt SQL Server database with some details on what happened to it.

If at this point you are already a bit irked by my use of capitalization in the DataBase Corruption Challenge, and the acronym of DBCC that I have used to describe it, then you are already ahead of many people reading about this challenge. Welcome to the challenge.
The challenge will be to download the corrupt database and attempt to recover it. If you can recover it, please send me the steps to recover it, along with some proof that the database has been recovered. The goal each week will be the following:

Read More »Introducing the DataBase Corruption Challenge (DBCC) – Week 1 Challenge

SQL Sunday Fun – Word Search with SQL Server DBCC Commands

SQL_DBCC_Commands

The following DBCC commands are all hidden in the word search.  Be aware, some of the DBCC commands are undocumented.

CACHESTATS CHECKCATALOG CHECKCONSTRAINTS
CHECKDB CHECKFILEGROUP CHECKIDENT
CLEANTABLE DROPCLEANBUFFERS FLUSHPROCINDB
FREE FREEPROCCACHE FREESESSIONCACHE
FREESYSTEMCACHE INDEXDEFRAG OPENTRAN
OUTPUTBUFFER PAGE PROCCACHE
SHOWCONTIG SHRINKDATABASE TRACEON
TRACESTATUS UNPINTABLE UPDATEUSAGE
USEROPTIONS

END OF PUZZLE ————————-

See also:

For more information on DBCC Commands: