SQL Server Ghost Records Generates Error Due to Corruption: Know How to fix it
“Object ID O_ID, index ID I_ID: The ghosted record count (HG_COUNT) in the header does not match the number of ghosted records (G_COUNT) found on page P_ID.”
You might have received above error message in SQL when you try to open SQL database or during table access. This error message encounter when the SQL Server ghost record does not match with the record count in the header. The Ghost records that are stored in the header are actually the record count which is generated from Ghost Cleaning which is done to optimize the performance of Delete command. So, when any type of mismatch occurs between original ghost records and record count in header then error appears. It makes your database inaccessible and frustrates you lot.
Generally this type of problem occurs due to corruption in SQL database which gets corrupted due to any of the following reasons:
- Improper shut down of system
- Power failure
- Damaged file system structure
- Corrupt index
- Use of corrupt media
- Bad sectors in disk
- Virus infections
All these factors corrupt your SQL database due to which SQL Server ghost record available on particular page does not match with the header record count and give rise to errors. After the appearance of error message you are unable to access your data as database becomes in accessible. So, in order to access your database you can restore it with current available backup but if you haven’t possessed any backup then you should follow below mentioned steps to resolve the error and access your SQL database.
- Check the physical component, if it is defective then replace it with a new one which might fix the issue
- You can also use DBCC CHECKDB command with repair clause which repair your corrupt SQL Database and fixes the error
In case if above mentioned steps fails to repair the corruption and you are getting same problem due to mismatch of SQL Server ghost records then you should opt for third party repair software. You can use MS SQL Database Repair software which safely repairs the corrupt SQL database and fixes all types of errors. The software supports all versions of MS SQL and can also restore lost objects like table, indexes, views, triggers etc.




