SQL Server, consistency error that I can't fix [migrated]

Solution 1:

It appears that you have a row in sys.syssingleobjrefs that does not correspond to rows in other system tables.

sys.syssingleobjrefs is listed as a System Base Table, and is only accessible over a DAC (administrator) connection. You can access it using sqlcmd.exe -A.

The documentation says:

To bind to a system base table, a user must connect to the instance of SQL Server by using the dedicated administrator connection (DAC). Trying to execute a SELECT query from a system base table without connecting by using DAC raises an error.

Important

Access to system base tables by using DAC is designed only for Microsoft personnel, and it is not a supported customer scenario.

I would only ever advise to do so when there is literally no other option. Messing with system tables destroy your database.

So you connect while logged in as an Administrator, or by logging in as sa. You probably want to just delete the invalid row, hopefully that should fix the issue.

WARNING!:

Do this entirely at your own risk. I strongly suggest you take a backup of the database, restore it to an entirely different instance, and test this there first.

USE [DBCopy];
GO

ALTER DATABASE DBCopy SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO

DELETE FROM sys.syssingleobjrefs
WHERE class = 128
  AND depid = 65536
  AND depsubid = 0;

GO

DBCC CHECKDB (DBCopy, REPAIR_ALLOW_DATA_LOSS)
  WITH NO_INFOMSGS, TABLOCK;

GO