Attempt to fetch logical page in database 2 failed. It belongs to allocation unit X not to Y
<p>Started to get following error when executing certain SP. Code related to this error is pretty simple, joining #temp table to real table </p>

<p>Full text of error:</p>

<pre><code>Msg 605, Level 21, State 3, Procedure spSSRSRPTIncorrectRevenue, Line 123
Attempt to fetch logical page (1:558552) in database 2 failed. It belongs to allocation unit 2089673263876079616 not to 4179358581172469760.
</code></pre>

<p>Here is what I found:
<a href="https://support.microsoft.com/en-us/kb/2015739" rel="nofollow">https://support.microsoft.com/en-us/kb/2015739</a></p>

<p>This suggests some kind of issue with database. I run <code>DBCC CHECKDB</code> on user database and on temp database - all passes.</p>

<p>Second thing I'm doing - trying to find which table those allocation units belong </p>

<pre><code>SELECT au.allocation_unit_id, OBJECT_NAME(p.object_id) AS table_name, fg.name AS filegroup_name,
au.type_desc AS allocation_type, au.data_pages, partition_number
FROM sys.allocation_units AS au
JOIN sys.partitions AS p ON au.container_id = p.partition_id
JOIN sys.filegroups AS fg ON fg.data_space_id = au.data_space_id
WHERE au.allocation_unit_id in(2089673263876079616, 4179358581172469760)
ORDER BY au.allocation_unit_id
</code></pre>

<p>This returns 2 objects in <code>tempdb</code>, not in user db. So, it makes me think it's some kind of data corruption in tempdb? I'm developer, not DBA. Any suggestions on what I should check next?</p>

<p>Also, when I run query above, how can I tell REAL object name that I understand? Like <code>#myTempTable______...</code> instead of <code>#07C650CE</code></p>