The B-trees in the database systems are the data structure that help in storing data in sorted order. As the data is stored in the sorted order, you can easily perform certain database tasks such as adding new records, deleting existing records, searching and retrieving data with lesser turnaround time. These b-trees have certain rules laid out using which all the operations are performed. At times, some nodes in the tree fail to comply with them because of database corruption, thereby damaging the database. In such cases, you should use the in-house methods to repair MDF file, failing which you should resort to using third-party sql repair software to do the needful.
Let us consider a situation in which you are getting the following error message while working on the MS SQL Server 2000 database:
“Table error: Object ID O_ID, index ID I_ID B-tree level mismatch, page P_ID1. Level LEVEL1 does not match level LEVEL2 from parent P_ID2.”
Corruption in the b-tree pages is the root cause of this error. Actually, the level in the child page, P_ID1, does not adhere to the b-tree rules causing this error.
To get rid of this error, the following methods could be performed to repair MDF file:
Checking the b-tree pages: First of all, you should check the b-tree pages to find out which page is incorrect and, also, look for any other error that has accompanied this error.
Addressing hardware-related errors: If the error has occurred because of any hardware malfunctioning, then that can be checked and fixed using following measures:
Checking error logs in MS SQL Server and Application logs in Windows operating system to check if the error has occurred because of hardware malfunctioning.
Running hardware diagnostics and fixing the errors.
Reinstalling the operating system after formatting (and backing) the hard drives.
Restoring from backup: If the hardware is perfectly in place, then check the state of the backup. If it is clean and updated, then you should restore the database from the backup.
Running DBCC CHECKDB: If the backup is not updated, then you should use the DBCC CHECKDB tool repair the database with the suggested repair clause.
If you still get the same error message even after performing these methods, then you should repair SQL database using a third-party MDF repair software. Such read-only tools have rich user interface that enable safe and easy sql recovery.