In the MS SQL Server databases, the IAM (Index Allocation Map), GAM (Global Allocation Map), SGAM (Shared GAM) are different types of pages that are used to store the records on the hard disks. These pages combine together in an extent, which is used to hold the metadata of the databases. A lot of times due to the mismatching in these files, the database gets corrupt and does not work properly. In such cases, you should try to repair MDF file using appropriate measures. However, if the problem is not addressed, then there is a strong case of using a third-party SQL repair software.
Consider a situation in which you are facing the following error message while working on an MS SQL Server 2000 database:
“Extent E_ID in database ID DB_ID is allocated in both GAM GAM_P_ID and SGAM SGAM_P_ID.”
The error has occurred because of corruption in the extents due to the irregularities in the IAM, GAM, and SGAM pages.
To overcome such corruption issues, you should perform the following methods ideally in the given order:
Fix the hardware corruption issues
: As is seen in such cases, the main reason for corruption is the malfunctioning of the hardware parts due to various reasons. You should try to minimize its repercussions using the following measures:
Check the Windows application logs and the SQL Server error logs to see whether the error is a consequence of hardware failure.
Run the hardware diagnostics and fix the error(s), if any.
You should swap the hardware components to isolate the exact error of corruption and try to repair the issue.
If the problem is persisting for a long time, then check if write-caching is enabled on the disks. If yes, then contact your hardware vendor to replace the disk.
In the end, you can try to convert to a new system be reinstalling the operating system after formatting the hard disks.
Restore from database
: If the hardware parts are perfectly in place, then you should restore database from the backup, if it is clean and updated.
Execute DBCC CHECKDB
: If nothing works out, then you should run DBCC CHECKDB with the repair clause to repair MDF file.
If the issue is still not resolved, then you should use a third-party SQL repair software to repair corrupt SQL database. With the help of these MDF file repair tools, you can get all the data without inflicting any damages.
The most recommended MS SQL repair software is Stellar Phoenix SQL Data Recovery, which repairs SQL database created in MS SQL Server 2008, 2005, 2000, and 7.0. Compatible with Windows 7, Server 2008, Vista, Server 2003, XP, and 2000, this .MDF repair utility repairs and restores collations, NDF files, tables, stored procedures, defaults, triggers, etc.