DBCC CHECKFILEGROUP is a database console command (DBCC) in Microsoft SQL Server that can be used to check the allocation and structural integrity of the pages in a filegroup of a database. Checking the allocation and structural integrity of the pages can be useful for identifying and correcting issues with the database that could cause errors or performance issues.
To use DBCC CHECKFILEGROUP, you must specify the name of the database you want to check the allocation and structural integrity of the pages for, and the name of the filegroup you want to check. You can also specify the NOINDEX option to skip checking the indexes, and the FAST option to perform a minimal check of the pages.
Here is an example of how to use DBCC CHECKFILEGROUP to check the allocation and structural integrity of the pages in the “MyFilegroup” filegroup of the “MyDatabase” database:
-- Check the allocation and structural integrity of the pages in the "MyFilegroup" filegroup of the "MyDatabase" database
DBCC CHECKFILEGROUP ('MyDatabase', 'MyFilegroup');
Here is an example of how to use DBCC CHECKFILEGROUP to check the allocation and structural integrity of the pages in the “MyFilegroup” filegroup of the “MyDatabase” database, but skip checking the indexes:
-- Check the allocation and structural integrity of the pages in the "MyFilegroup" filegroup of the "MyDatabase" database, but skip checking the indexes
DBCC CHECKFILEGROUP ('MyDatabase', 'MyFilegroup', NOINDEX);
Here is an example of how to use DBCC CHECKFILEGROUP to perform a minimal check of the pages in the “MyFilegroup” filegroup of the “MyDatabase” database:
-- Perform a minimal check of the pages in the "MyFilegroup" filegroup of the "MyDatabase" database
DBCC CHECKFILEGROUP ('MyDatabase', 'MyFilegroup', FAST);
The output of DBCC CHECKFILEGROUP will be a list of any issues found with the allocation or structural integrity of the pages in the filegroup of the database. If no issues are found, a message will be displayed indicating that the filegroup is consistent.
Please note that DBCC CHECKFILEGROUP can be a resource-intensive operation, as it requires checking the allocation and structural integrity of all pages in the filegroup. As a result, it is generally best to avoid using DBCC CHECKFILEGROUP in production environments, or to use it sparingly and only when necessary.
DBCC CHECKFILEGROUP is a useful tool for checking the allocation and structural integrity of the pages in a filegroup of a database in SQL Server, but it should be used with caution.
Need help with this or an of the other DBCC commands? The team at Stedman Solutions, LLC specializes in repairing corrupt databases and heping when things go wrong.
REPAIR_ALLOW_DATA_LOSS might make your corrupted SQL Server database ‘consistent’ again — but at the cost of silently throwing away rows, pages, or entire tables you didn’t even know were affected. See the real dangers explained here.
More from Stedman Solutions:
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!
