Error 2547

Severity

16

Message text

Table Corrupt: Segment number %d specified for use in the segment map in sysusages has no entry in syssegments. The entry in sysusages is for dbid %d (db name = %S_DBID), with a virtual starting address of %ld.

Explanation

Three system tables store information about segments: master..sysusages, and two system tables in the user database, sysindexes and syssegments. When you allocate a device to a database, an entry is added to master..sysusages, and sysusages.segmap provides bitmaps to the segments of the database on each device. When you create a database, Adaptive Server creates the syssegments table in that database and adds rows in the table for the system, default, and log segment. Whenever you add or update segments in a user database, syssegments is updated to reflect new or changed information about the user segments.

Error 2547 is raised when a dbcc check finds an invalid value of sysusages.segmap for a segment, which can happen if you load a user database with user segments different from those in the target database. For example, if you load a database and the target database is larger than the source of the load, and contains a segment that is not in the source, the syssegments table in the newly loaded database will not contain the segment from the higher portion of the target database. As a result, the segmap column in sysusages includes a value not found in syssegments in the newly loaded database, and the dbcc check raises the 2547 error.

NoteIf the segmaps disagree within the size of the database being loaded, sysusages will be updated to match the loaded database and no 2547 error will be encountered.

Action

You can correct the problem by updating sysusages to remove the affected segment information, then defining the necessary segment with sp_addsegment.

Take the following steps:

  1. Execute the following command:

    1> select * from master..sysusages where dbid = <dbid>
    2> go
    

    Where <dbid> is the dbid in the error message text.

    Note that the segment number reported in the message text is the exponent (power) to which 2 is raised to derive sysusages.segmap. Use this information to find the segmap row in the query output corresponding to the value reported in the error.

    For example, if sysusages contained a row with segmap = 11, and your error text reported segment number 3; then 2**3 = 8, which is the number by which you need to reduce the segmap value (11) to arrive at a corrected segmap value of 3.

  2. Allow updates to system tables:

    1> sp_configure "allow updates", 1
    2> go
    
  3. Correct the affected sysusages row:

    1> update master..sysusages set segmap = <new_segmap> 
    2> where dbid = <dbid> and segmap = <old_segmap>
    3> go
    

    In our example:

    1> update master..sysusages set segmap=3 where dbid=5 and segmap=11
    2> go
    
  4. Check that exactly one row was affected, then commit:

    1> commit
    2> go
    
  5. Disallow updates to system tables:

    1> sp_configure "allow updates", 0
    2> go
    
  6. Shut down and restart the server.

  7. Run sp_addsegment to add any necessary segments to the database. Remember to dump the database after using sp_addsegment.

Additional information

If errors persist, contact Sybase Technical Support. Before you call, have the information on hand listed in “Reporting errors”, including the output:

Segment errors often result from loading a dump to a target database that is logically different (that is, the placement of segments on the devices is different) from the source database. For a detailed discussion of segments and segment mapping, see

Versions in which this error is raised

All versions