Sql-server – Unusual error message – sql server the row object is inconsistent. please rerun the query

sql serversql-server-2012

I'm reviewing the error logs for an instance of SQL Server 2012 and found the following error in the log (error 669):

The row object is inconsistent. please rerun the query

I googled and the only answers seem to be generic listings of sys.messages showing the error number and error description.

Has anyone come across this error before? My thoughts so far is it indicates some kind of data corruption, but the error message doesn't say which database is affected.

Best Answer

As a first step, I'd suggest running DBCC CHECKDB against all databases on that instance. Here's a quick script that will run against each database (including system databases). This could take quite a bit of time (depending on the size of your databases), but you need to let it finish running.

DECLARE @Message VARCHAR(max);
DECLARE @databaseList AS CURSOR;
DECLARE @databaseName AS NVARCHAR(500);
DECLARE @tsql AS NVARCHAR(500); 

SET @databaseList = CURSOR  LOCAL FORWARD_ONLY STATIC READ_ONLY 
FOR
        SELECT QUOTENAME([name])
        FROM sys.databases
        WHERE [state] = 0;
OPEN @databaseList;
FETCH NEXT FROM @databaseList into @databaseName;
WHILE @@FETCH_STATUS = 0
BEGIN
    SET @Message = 'Starting DBCC for ' + @databaseName + ' -> (' + convert(varchar,getdate(),121) + ')'
    RAISERROR(@Message,0,1) WITH NOWAIT
    SET @tsql = N'DBCC CheckDB(' + @databaseName + ') WITH ALL_ERRORMSGS,NO_INFOMSGS;';
    RAISERROR(@tsql,0,1) WITH NOWAIT
    exec SP_EXECUTESQL @tsql;
    SET @Message = 'Completed DBCC for ' + @databaseName + ' -> (' + convert(varchar,getdate(),121) + ')'
    RAISERROR(@Message,0,1) WITH NOWAIT

    FETCH NEXT FROM @databaseList into @databaseName;
END
CLOSE @databaseList;
DEALLOCATE @databaseList;