Dbcc Checkdb failed with “The database could not be exclusively locked to perform the operation.” Error
You may experience below error while executing dbcc checkdb (actually any dbcc check command) on a database:
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.
This error is created when at least one of the below condition is true:
At least one other connection is using the database against which you run the DBCC CHECK command.
The database contains at least one file group that is marked as read-only.
Please follow below steps to resolve this problem:
1. Create a database snapshot of the database for which you want to perform the checks.
2. Run the DBCC CHECK command against the database snapshot.
3. Drop the database snapshot after the DBCC CHECK command is completed.
Please refer to http://support.microsoft.com/kb/928518 for more details.