A database snapshot cannot be created because it failed to start : DBCC CHECKDB

DBCC CHECKDB is one of the powerful DBCC command. It Checks the logical and physical integrity of all the objects in the specified database.

However, when you try to run the DBCC CHECKDB, you might come across a error "A database snapshot cannot be created because it failed to start." when checked further, there might be error as below.

"A database snapshot cannot be created because it failed to start.  Write to sparse file '<DataFileLocation>\<databaseName>.mdf:MSSQL_DBCCXX' failed due to lack of disk space.  The database snapshot for online checks could not be created. Either the reason is given in a previous error or one of the underlying volumes does not support sparse files or alternate streams. Attempting to get exclusive access to run checks offline.  The database could not be exclusively locked to perform the operation.  Check statement aborted. The database could not be checked as a database snapshot could not be created and the database or table could not be locked. See Books Online for details of when this behavior is expected and what workarounds exist. Also see previous errors for more details"

As the above error is self explanatory, DBCC CheckDB has failed because due to insufficient space. If you understand the error correctly, What DBCC CheckDB does is, it directly does not run the CheckDB on the database. Rather it takes a Hidden Database Snapshot on the same location where the data file is located and then runs the CheckDB on this snapshot taken.

Now the solution for this is either increase the disk space to accumulate the snaphot to be taken and then Re-Run DBCC CheckDB on that database. if this is not possible due to various contraints, best possible solution is to Take a Database Snapshot manually to a location where there is enough space and then run DBCC CheckDB manually on this snaphot taken. below mentioned is the script to take a database Snapshot.

(Name ='DBNameSStobetaken',FileName='ValidFIlePath\NameOFSnapshotFileName.ss1')

Example Screenshot:

If you see below, now you can see that a Snapshot is created.

Once the Snapshot is taken you can then again run the DBCC CheckDB on this snapshot.