![]() | ![]() |
Home |
|
|
Troubleshooting and Error Messages Guide |
|
| Chapter 3 Error Message Writeups |
|
| dbcc Errors |
|
| Error 2521 |
16
Table Corrupt: Page is linked but not allocated. Run DBCC TABLEALLOC to correct the problem. (alloc page#=%ld, extent id=%ld, logical page#=%ld, object id in extent=%ld, index id in extent=%ld, object name=%S_OBJID)
This error may be caused by a hardware problem.
This error is serious, especially if it occurs on a table's data pages. It means that a page is currently in use by a table or index but it has not been marked as allocated. The same page could be allocated again, resulting in a loss of whatever data resides on the page.
Pages encountering the 2521 error will not be included in a database dump. This is because database dumps are performed by reading allocation pages and not by traversing page chains. Therefore, this error should be corrected before dumping the database.
The instructions below are for fixing 2521 errors once they have occurred. Two easy-to-use strategies exist for detecting this error sooner in the future. Refer to "Detecting Allocation Errors as Early as Possible" in the Encyclopedia of Tasks chapter for information about these strategies.
Occasionally dbcc checkalloc reports this error when no real error condition exists. You can either check to see if these errors are real, or continue with this section and take action to correct them, whether or not they reflect a real allocation error.
Because the process used to determine whether the errors are real can be time-consuming, you may want to go directly to "Error Resolution" below.
Run dbcc checkalloc in single-user mode if you suspect the 2521 error messages are incorrect. If the error is in master, use the section "How to Start Adaptive Server in Single-User Mode" in the Encyclopedia of Tasks chapter for instructions about how to invoke Adaptive Server in single-user mode. Refer to "dbcc" in the Reference Manual for information about dbcc checkalloc.
If many of these errors are occurring, it is possible to clear them all at once by using the dbcc checkalloc and dbcc checkalloc with fix option commands. Refer to "How to Fix and Prevent Allocation Errors" in the Encyclopedia of Tasks chapter for information about using dbcc checkalloc.
If the text of the error message includes a real object name, not a number, then the error is on an existing object to which the system catalog has correct references. Continue now to "Identify Table: User or System Table".
If a number appears instead of the object name, then that object only partially exists and the error must be corrected using the procedure described in "How to Fix and Prevent Allocation Errors" in the Encyclopedia of Tasks chapter.
Look at the value for "object id in extent" in the error message. If it is 100 or greater, go to "Action for User Tables". If the "object id in extent" is below 100, it is a system table and requires a different procedure described in the section "Action for System Tables".
If the "object id in extent" in the error message is 100 or greater, follow these steps to correct the error:
Check the value of the "index id in extent" in the error message to determine whether it is a table (value is 0) or an index (with a value between 0 and 255).
Run dbcc tablealloc or dbcc indexalloc, depending on whether the object named in the 2521 error message is a table or an index. Before you run the appropriate command, keep the following in mind:
dbcc tablealloc can correct this problem on a table or an index, but if the problem is on an index, you can avoid affecting the entire table by using the dbcc indexalloc command. If the table is large or heavily used, it may be more practical to use dbcc indexalloc.
These commands correct the error only when run in the full or optimized mode. Do not specify the nofix option, or the 2521 error will not be corrected.
You can use either the "object name" or "object id in extent" values from the error message in the commands above where the argument "object_name" appears.
Use the command appropriate for your situation:
For Tables (index id in extent = 0) | For Indexes (0 < index id in extent < 255) |
1> dbcc tablealloc (object_name) 2> go | 1> dbcc indexalloc (object_name, 2> index_id_in_extent) 3> go |
Refer to "dbcc" in the Reference Manual and "Checking Database Consistency" in the System Administration Guide for information about the dbcc tablealloc and dbcc indexalloc commands.
If the "object id in extent" in the error message is less than 100, follow these steps to correct the error:
Put the affected database in single-user mode:
If the database is master, use the procedure in "How to Start Adaptive Server in Single-User Mode" in the Encyclopedia of Tasks chapter, and then continue with this procedure.
If the database is not master, use the sp_dboption stored procedure to put the affected database in single-user mode:
1> use master 2> go
1> sp_dboption database_name, single, true 2> go
1> use database_name 2> go
1> checkpoint 2> go
Check the value of the "index id in extent" in the error message to determine whether it is a table (value is 0) or an index (value is greater than 0).
Run dbcc tablealloc or dbcc indexalloc, depending on whether the object named in the 2521 error message is a table or an index. Before you run the appropriate command, keep the following in mind:
dbcc tablealloc command above can correct either a table or an index, but if the problem is on an index, you can avoid affecting the entire table by using the dbcc indexalloc command. If you need to minimize the amount of time the table is unavailable, it may be more practical to use dbcc indexalloc.
These commands correct the error only when run in the full or optimized mode, with the fix option specified. This is necessary because the default value is nofix when these commands are run on system tables.
You can use either the "object name in extent" or "object id" values from the error message in the commands above where the argument "object_name" appears.
Use the command appropriate for your situation:
For Tables (index id in extent = 0) | For Indexes (0 < index id in extent < 255) |
1> dbcc tablealloc (object_name, 2> full, fix) 3> go | 1> dbcc indexalloc (object_name, 2> index_id_in_extent, full, fix) 3> go |
Turn off single-user mode in the database:
If the database is master, use the procedure in "Returning Adaptive Server to Multiuser Mode" in the Encyclopedia of Tasks chapter.
If the database is not master, use the following procedure:
1> use master 2> go
1> sp_dboption database_name, single, false 2> go
1> use database_name 2> go
1> checkpoint 2> go
Refer to "dbcc" in the Reference Manual and "Checking Database Consistency" in the System Administration Guide for information about the dbcc tablealloc and dbcc indexalloc commands.
All versions
|
|