Assume that you have a database that contains read-only filegroups in Microsoft SQL Server 2014. When you run DBCC CHECKDB on the database, the DBCC command can’t create a database snapshot for the database.
If there's no other connection to the database, the DBCC operation is completed without errors. However, you receive the following error message:
DBCC CHECKDB will not check SQL Server catalog or Service Broker consistency because a database snapshot could not be created or because WITH TABLOCK was specified.
If there are other connections to the database, the DBCC operation fails, and you receive the following error message:
Msg 5030, Level 16, State 12, Line 1
The database could not be exclusively locked to perform the operation.
Msg 7926, Level 16, State 1, Line 1
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.
Cumulative Update information
The issue was first fixed in the following cumulative update of SQL Server.
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. We recommend that you download and install the latest cumulative updates for SQL Server:
To reproduce this problem, run the following commands in SQL Server:
-- Open a new query that is named conn1, and then create a new database. CREATE DATABASE DbTest GO -- Add a new file group. ALTER DATABASE DbTest ADD FILEGROUP FGTest GO -- Add a file to the new file group. ALTER DATABASE DbTest ADD FILE (NAME=DbTest_Data2, FILENAME=''C:\temp\DbTest_Data2.ndf') TO FILEGROUP FGTest GO -- Change the file group to read-only. ALTER DATABASE DbTest MODIFY FILEGROUP FGTest READONLY GO -- Run the DBCC CHECK command in the conn1 query. DBCC CHECKDB (DbTest) -- The DBCC CHECK command runs correctly. However, you may receive the following message: "DBCC CHECKDB will not check SQL Server catalog or Service Broker consistency because a database snapshot could not be created or because WITH TABLOCK was specified." -- Open a new query window that is named conn2, and then set the database as DbTest. This action opens a connection to the DbTest database. -- Return to the conn1 query, and run the DBCC command again. DBCC CHECKDB (DbTest) -- Notice the error message that is mentioned in the "Symptoms" section.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.