Monday, April 2, 2012

A safe approach to database recovery in case of IAM chain corruption in SQL Server 2008

SQL Server 2008 is the best tool for database developers and administrators as it incorporates some of the major improvements over the earlier versions. It has support for large data sets and the ability to handle multiple users. The new 'Performance Studio' provides you with a collection of tools for easy monitoring and troubleshooting the system. It allows you to build up an efficient policy management system and help database administrators in carrying out various administrative tasks. Regardless of all these benefits, there are various contingencies that lead to corruption in the SQL databases. The potential reasons behind database corruption include virus infection, hardware failures, operating system bugs, etc. As a consequence, all the valuable objects in the SQL database become inaccessible. In order to recover your lost invaluable data, you should perform SQL recovery through proficient third-party software.


IAM chain corruption is a common occurrence on SQL Server 2008. This is usually accompanied by the below given error by DBCC CHECKDB:


"Msg 2576, Level 16, State 1, Line 1 
The Index Allocation Map (IAM) page (0:0) is pointed to by the previous pointer of IAM page (1:153) in object ID 0, index ID -1, partition ID 0, alloc unit ID 72057594042384384 (type Unknown), but it was not detected in the scan."


The system table 'sysallocunits' usually has a reference to the first IAM page, the root page, and the first page. The above error says that metadata does not include a reference to the first IAM page in the IAM chain (page 1:153). This indicates corruption in the 'sysallocunits' system table.


If you try to use the 'repair_fast' and 'repair_rebuild' options in this case, you may get no significant results. In order to resolve the issue, you may try the following series of steps:

  •     Start a transaction
  •     Write the rowcounts for all system objects and tables in your database.
  •     Now use CHECKDB for repairing the database.
  •     Make sure that the problem is resolved and the error is not seen again
  •     Rerun DBCC CHECKDB to verify the database.
  •     Examine the rowcounts once again.
  •     Commit the transaction

The 'repair_allow_data_loss' should be the minimum repair level for this case. If the problem persists, you may try professional SQL 2008 database recovery software. These third-party tools extensively scan SQL databases to recover damaged or inaccessible objects, including tables, views, indexes, constraints, triggers, etc. Moreover, they are compatible with Windows 7, Server 2008, Vista, Server 2003 and XP.