Skip navigation

I am getting an error 2521 on my SQL Server - what can I do?

A. Full error is "Msg 2521, Level 16, State 1, Server xxx, Table Corrupt: Page is linked but not allocated; check the following pages and table: alloc page#=<xxx> extent id=6676856 logical page#=6676856 object id in extent=8 (object name=syslogs) index id in extent=0 Make sure that is a "real" 2521 by running the dbcc in single-user mode as they can be spuriously reported if updates are occuring at the time of the dbcc.

Make sure there are no other errors in the dbcc either.

At this point if you have a good backup and will not lose any data, then now is the time to use it. If you don't have a good backup then look at your backup procedures! To try and resolve the problem read on :-

Use DBCC PAGE (doc'd in the Books Online) to determine whether the page is a data or index page. If it is an index you are in luck and you may be able to drop and recreate the index.

If it is not an index page or this does not work then you will need to transfer all the data/objects into a new database. It must be a different database as otherwise the pages your table is using but aren't allocated may be allocated for the new table and cause more problems. If the transfer fails then manually select out data in ranges based on keys above and below the broken point.

Then drop the old table, recreate it and transfer the data back in.

If the above is not possible due to the size of the database or other reasons then your only alternative is to pay for Microsoft PSS support who may be able to patch the pointers in the tables/pages directly for you. However this sort of fix is not guaranteed and is done (if at all) on a best efforts basis totally at your risk.

TAGS: SQL Server
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.