How to check database integrity
This article explains how to check database integrity and repair it if necessary.
Microsoft SQL Server Management Studio is required to do this.
-
- Open Microsoft SQL Server Management Studio.
- Expand the Databases menu item.
- Click on the database “NoSpamProxyDB” and then on New Query in the upper left area. A white window now appears on the right side. To check a suspicious database for errors, you can use the following command in SQL Management Studio:
DBCC CHECKDB ('NoSpamProxyDB')
The next command would then correct these errors. You must set the Restrict Access mode from MULTI_USER to SINGLE_USER under Options in the database's Properties before running the command.
DBCC CHECKDB ('NoSpamProxyDB', REPAIR_REBUILD)
The success is checked again with the following command.
DBCC CHECKDB ('NoSpamProxyDB')
No red error messages should appear in the output now. If the database could not be successfully repaired and red error messages still appear, execute the more aggressive command
DBCC CHECKDB ('NoSpamProxyDB', REPAIR_ALLOW_DATA_LOSS)
You should also check the success with the above command afterwards. If the database cannot be repaired, you can also create a new database via the NoSpamProxy interface. The point can be found under the node “Troubleshooting”.If problems with the SQL Server occur often, a defect on the SQL Server is likely.