16 Nov 2016

DBCC CHECKDB Consistency ERROR: SQL Server error in-row data RSVD page count is incorrect, Run DBCC UPDATEUSAGE

Today SQL server DBCC CHECKDB job got failed and we got  the alert for the same. When we checked the JOB History we got the below error message:

DBCC CheckDB Job failed with 4 Consistency errors:

"Message

Source: Check Database Integrity Task      Executing query "USE [DB_NAME]  ".: 50% complete  End Progress  Error: 2016-11-16 00:30:41.42     Code: 0xC002F210     Source: Check Database Integrity Task Execute SQL Task     Description: Executing the query "DBCC CHECKDB(N' DB_NAME ')  WITH NO_INFOMSGS  " failed with the following error: "The In-row data USED page count for object "VER_DETAIL", index ID 0, partition ID 35789274218496, alloc unit ID 35789274218496 (type In-row data) is incorrect. Run DBCC UPDATEUSAGE.  The In-row data RSVD page count for object "PI_DETAIL", index ID 0, partition ID 48600034836480, alloc unit ID 48600034836480 (type In-row data) is incorrect. Run DBCC UPDATEUSAGE.  The In-row data USED page count for object "PO_RECEIPT", index ID 0, partition ID 58037252456448, alloc unit ID 58037252456448 (type In-row data) is incorrect. Run DBCC UPDATEUSAGE.  The In-row data USED page count for object "PT_ASSIGN_DETAIL", index ID 0, partition ID 64328730869760, alloc unit ID 64328730869760 (type In-row data) is incorrect. Run DBCC UPDATEUSAGE.  CHECKDB found 0 allocation errors and 1 consistency errors in table 'VER_DETAIL' (object ID 546100986).  CHECKDB found 0 allocation errors and 1 consistency errors in table 'PI_DETAIL' (object ID 741577680).  CHECKDB found 0 allocation errors and 1 consistency errors in table 'PO_RECEIPT' (object ID 885578193).  CHECKDB found 0 allocation errors and 1 consistency errors in table 'PT_ASSIGN_DETAIL' (object ID 981578535).  CHECKDB found 0 allocation errors and 4 consistency errors in database 'DB_NAME'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.  End Error  Progress: 2016-11-16 00:30:41.43     Source: Check Database Integrity Task .

Reason :

This database was migrated from SQL 2000 to SQL 2008 .SQL Server 2000 used to update the page space used,reserved space metadata. when SQL Server 2008 came along, this is no longer the case so if we didn't run DBCC UPDATEUSAGE after the  migration of database, this error is expected to appear when we run DBCC CHECKDB.

Resolution: 

STEP-1:  in Error message whenever we see "Run DBCC UPDATE USAGE", first of all we will take the FULL backup of our database.

Backup database "DB_NAME" to disk='U:\PATH\DB_NAME.bak' with INIT,STATS=10;

STEP-2: open new SQL server query window and run DBCC UPDATEUSAGE(DB_NAME)
it will correct pages and row count inaccuracies in the catalog views.once page count is corrected SQL server database will work fine and there will be no data inconsistency errors.


STEP-3:  Run DBCC CHECKDB to ensure all the consistency errors are fixed.



Now our database is clean and we have fixed the issue.

banner
Previous Post
Next Post

0 comments: