Sql-server – DBCC CheckDB space requirements

dbccdbcc-checkdbsql serversql server 2014

Ran into the following error…

K:\Microsoft SQL
Server\Data\MyAudit3_Dat.NDF_MSSQL_DBCC50: Operating system error
112(There is not enough space on the disk.) encountered.

In this case the disk space was very low which needed remediation… However, it lead me to ponder
what are the disk space requirements for dbcc checkdb?

Best Answer

CHECKDB need two types of storage while executing:

  1. Tempdb. This is to keep track of where it is (to simplify quite a bit). This is what Dominique refers to. However, this was not your problem (as we can see by the error message).

  2. On the same disk where each data file for the database resides. It creates one "CHECKDB working file" for each data file for your database. Since CHECKDB work with an internal snapshot database, it need to do copy-on-write. I.e., whenever a modification is done in your database, SQL Server need to first copy that extent (64 KB block) to a snapshot file. You can see the snapshot file in the error message - this is how we can deduce that the problem isn't with tempdb.

I.e., the more data you modify, the more storage is needed for the snapshot file. You don't want to have a checkdb running while you rebuild an index or do a large import, as a couple of examples. As you can imagine, we can't say how much space is needed since we don't know how much data modifications you do while checkdb is running.

So, check the timing for your jobs.