In SQL Server 2008, you receive error 605 and error 824 when you run a query that inserts data into a temporary table in SQL Server

If your application makes frequent use of #temp tables in stored procedures, you may see error 605 and 824 in your Event Viewer with the following:

Msg 605, Level 21, State 3, Line 1 
Attempt to fetch logical page (1:225) in database 2 failed. It belongs to allocation unit 281474980315136 not to 504403158513025024.

My immediate suspicion was database corruption, however all DBCC scans came back clean.  Looking at the database ID specified in the error message (2) we know it’s tempDB, and not our actual production database.

Turns out, in SQL Server 2008, we can enable a trace flag to get around this issue:   T4135


Set it, restart the SQL Server service, and your problems (at least those relevant to errors 608 and 804) should be solved.  I am running the latest build of R2, so no additional updates were necessary.

About these ads
Tagged , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: