Tables of SQL Server database can be checked for consistency by running DBCC CHECKTABLE. An administrator requires to take immediate
MDF Recovery (SQL uses .mdf file extension to store its database) actions on encountering any issues with database table. Failing to do so might exaggerate the problems further.
After a general overview, here is a specific problem that will help you comprehend the problem. Let's say, you as an SQL Server administrator experiences some database access related issues that doubt database corruption. On running consistency check on the database table(s) using DBCC CHECKTABLE command, this returns the below or similar error message:
Table error: Object ID O_ID, index ID I_ID, page P_ID. Test (TEST) failed. Address 0xADDRESS is not aligned.
Depending on the exact cause, this specific error occurs in two states: State 9 and State 102.
Explanation
This type of corruption is likely to occur because of hardware reasons. As the error suggests, a structure defined at ADDRESS doesn't exists in expected 4-byte aligned condition. If this error occurs with state 9, it occurs when free space offset is incorrectly aligned, while in case of state 102, this occurs when record is incorrectly aligned.
User Action
Perform hardware diagnostics and isolate the related issues, if any. To do so, you can check SQL Server™ error log, application logs, and Windows system logs. If corruption seems to occur repeatedly, try changing different hardware components.
If hardware problems is not the case, restore the database from your previous clean data backup.
In case no suitable backup is present, run DBCC CHECKDB and determine the repair clause. Now execute the same command with the suggested repair clause. Doing so can even delete your data or cause more damages, so it is recommended to backup your database prior running this command.
If database cannot be repaired by DBCC repair command, use a third-party .mdf Recovery software to scan and repair the database. An
MDF Repair utility can be easily operated and can repair the corrupted SQL Server database, irrespective of the nature of corruption.
SQL Recovery Software is a comprehensive utility designed to scan and repair a corrupted MDF database file and restore its contents to a safe location. As a competent .mdf Recovery tool, it can restore all database components like, tables, stored procedures, defaults, triggers, views, and others. It supports MS SQL Server 2008, 2005, and 2000.