Error 2546

Severity

16

Message text

Table Corrupt: Extent id %ld on allocation pg# %ld has objid %ld and used bit on, but reference bit off.

Explanation

This error is reported by dbcc checkalloc if an allocation structure or extent is not linked to the other extents for the object referenced by “objid”, but does reference a page that is linked in the object’s page chain. Each occurrence of this error can represent a loss of up to eight pages on disk, or 16K. The pages cannot be used until the error is corrected. Error 2546 can lead to data corruption and can result in various run-time failures. If no other errors are occurring, you can wait until nonpeak hours to correct the problem.

NoteThe instructions below are for fixing 2546 errors once they have occurred. Two easy-to-use strategies exist for detecting this error earlier. Refer to “Fixing and preventing allocation errors” and “Detecting allocation errors early” in the chapter “Other Useful Tasks” in the most recent version of the Troubleshooting and Disaster Recovery guide for information about these strategies.

Action

Occasionally dbcc checkalloc reports this error when no real error condition exists. You can either check to determine whether the error is real, or continue with this section and take action to correct it, whether or not it reflects a real allocation error.

Because the process used to discover whether or not the error is real can be time-consuming, you may want to go directly to “Error resolution”.


Verifying that the error is real

Run dbcc checkalloc in single-user mode if you suspect the 2546 error messages are incorrect. If the error is in master, use “Starting Adaptive Server in single-user mode” in the chapter “Server Recovery Tasks” in the most recent version of Troubleshooting and Disaster Recovery for instructions. Refer to “dbcc” in the Reference Manual: Commands for information about dbcc checkalloc.


Error resolution

If many of these errors are occurring, it is possible to clear them all at once by using dbcc checkalloc and dbcc checkalloc with the fix option. Refer to “Fixing and preventing allocation errors” in the chapter “Other Useful Tasks” in the most recent version of Troubleshooting and Disaster Recovery for information about using dbcc checkalloc.

Execute the following query to make sure the object exists and is correctly referred to in the system catalog:

1> use <database_name> 
2> go
1> select object_name (<objid_from_error_msg>)
2> go

If an object name is returned, then the error is on an existing, correctly referenced object. In this case, go to the section “Identify table: User or system table.”

If a number, or something other than an object name is returned, use “Fixing and preventing allocation errors” in the chapter “Other Useful Tasks” in the most recent version of Troubleshooting and Disaster Recovery.


Identify table: User or system table

Look at the value for “objid” in the error message. If it is 100 or greater, continue to the next section “Action for user tables.” If the “objid” is below 100, it is a system table and requires a different procedure as described in the section “Action for system tables”.


Action for user tables

If the “objid” in the error message is 100 or greater, follow these steps to correct the error:

  1. Run the dbcc page command described in “Finding an object name from a page number” in the chapter “Other Useful Tasks” in the most recent version of Troubleshooting and Disaster Recovery for instructions to obtain the value for the “indid.” Substitute the value for “extent id” in the 2546 error message in place of the “page_number” as described in the procedure.

  2. Run dbcc tablealloc or dbcc indexalloc, depending on whether the value for “indid” indicates it is a table or an index. Before you run the appropriate command, keep in mind:

    • dbcc tablealloc corrects this problem on a table or an index, but if the problem is on an index, use dbcc indexalloc to avoid affecting the entire table. If the table is large or heavily used, it may be more practical to use dbcc indexalloc.

    • These commands will correct the error only when run in full or optimized mode as long as the nofix option is not specified (the default for user tables).

    • Use the object name, if you know it, or the “objid” value from the error message in the commands above where the argument <objid> appears.

Use the command appropriate for your situation:

Tables (index ID in extent = 0)

Indexes (0 < index ID in extent < 255)

1> dbcc tablealloc (<objid>) 2> go

1> dbcc indexalloc (<objid>, <indid>) 2> go

Refer to “dbcc” in the Reference Manual: Commands and “Checking Database Consistency” in the System Administration Guide: Volume 2 for information about dbcc tablealloc and dbcc indexalloc.


Action for system tables

If the “objid” in the error message is less than 100, follow these steps to correct the error:

  1. Run the dbcc page command described in the procedure “Finding an object name from a page number” in the chapter “Other Useful Tasks” in the most recent version of Troubleshooting and Disaster Recovery to obtain the value for the “indid.” Substitute the value for “extent id” in the 2546 error message in place of the “page_number” as described in the procedure.

    WARNING! The procedure in step 1 uses the dbcc page command. Use the dbcc page command only as directed. This command is undocumented, nonstandard, and is provided “as is” without any warranty. Sybase Technical Support does not support this command for general use. Although the command syntax is provided for reference, use this command only in the specific diagnostic situations described, and with the specific syntax shown. Failure to do so could cause performance problems and database corruption.

  2. Put the affected database in single-user mode:

    • If the database is master, use the procedure in “Starting Adaptive Server in single-user mode” in the chapter “Server Recovery Tasks” in the most recent version of Troubleshooting and Disaster Recovery, then go to step 3.

    • 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
      
  3. Run dbcc tablealloc or dbcc indexalloc, depending on whether the value of the “indid” from step 1 above indicates that it is a table or an index, then execute the appropriate command. Before you run the appropriate command, keep these facts in mind:

    • dbcc tablealloc correct either the error on a table or an index, but if the problem is on an index, you can avoid affecting the entire table by using dbcc indexalloc. If you need to minimize the amount of time the table is unavailable, it may be more practical to use dbcc indexalloc.

    • These commands will correct the error only when run in the full or optimized mode with the fix option specified, because the default for system tables is nofix.

    • You can use the object name if you know it, or “object id” value from the error message in the commands above where the argument <objid> appears.

    Use the command appropriate for your situation:

    Tables (indid = 0)

    Indexes (0 < indid < 255)

    1> dbcc tablealloc (<objid>, 2> full, fix) 3> go

    1> dbcc indexalloc (<objid>,<indid>, 2> full, fix) 3> go

  4. Turn off single-user mode in the database:

    • If the database is master, use “Returning Adaptive Server to multiuser mode” in the chapter “Server Recovery Tasks” in the most recent version of Troubleshooting and Disaster Recovery.

    • 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: Commands and “Checking Database Consistency” in the System Administration Guide: Volume 2 for information about dbcc tablealloc and dbcc indexalloc.

Versions in which this error is raised

All versions