Error 1142

Severity

22

Message text

Invalid OAM Page %ld. Found pstat=0x%x, object=%ld, database=%d, indid=%d.

Explanation

Depending on on the cause, error 1142 can be either a serious error due to actual corruption in the database or a result of misusing a system function (data_pgs, reserved_pgs, rowcnt, or used_pgs). Error 1142 can occur during run time as well as during recovery (during Adaptive Server startup, load database, or load transaction).


Incorrect system function use

The error can occur from incorrect use of any of the following system functions that retrieve information about allocation pages:

For example, if you incorrectly type the following query using version 12.5:

1> use pubs2
2> go

1> select reserved_pgs (id, root) from 
2> master..sysindexes
3> where id = <object_ID>("<table_name>") 
4> go

error 1142 is raised because the reserved_pgs system function attempted to retrieve an invalid OAM page. (Replacing root in the above example with a correct OAM page, for example doampg, would give expected results.)


Incorrect OAM page entries

If you get error 1142 and you did not use system functions across databases, this error is a sign of serious corruption in your database. To verify this, run dbcc tablealloc on the object or dbcc checkalloc on the database as discussed in “Incorrect OAM page entry in sysindexes”, step 3.

Adaptive Server uses OAM pages to track how space is allocated for Adaptive Server objects. Error 1142 occurs when Adaptive Server tries to retrieve an OAM page and the status of that page indicates that it is not an OAM page. It occurs with the following states:

State

Meaning

1

The status of the first OAM page indicated that it was not a valid OAM page.

2

Adaptive Server encountered an invalid OAM page during recovery or during an undo or a redo of a truncate table command.

3

Adaptive Server encountered an invalid OAM page while preparing to read and install an OAM page in the buffer cache.

4

Adaptive Server encountered an invalid OAM page during deallocation of an object page.

Action

Recovery from this error depends on the cause. Follow the instructions below, depending on the error’s origin.


Incorrect system function use

When you want to use the system functions specified in “Incorrect system function use” across databases, select the database to be accessed with a use database command, then run the query for the current database.


Recovery

If error 1142 occurred during the threshold accounting phase of recovery, the database is marked “suspect” and the object referenced in the error message output is corrupted. To determine whether the error occurred during this phase of recovery, look in the error log to determine whether the error occurred immediately after recovery.

If error 1142 occurs after messages like these, perform the following steps to recover from the error. Otherwise, go to “Incorrect OAM page entry in sysindexes”.

  1. Turn off threshold accounting for the database affected by the 1142 error so that it can complete recovery:

    1> use master
    2> go
    
    1> sp_dboption <database_name>, "no free space acctg", true
    2> go
    

    Where <database_name> is the name of the database in the error message.

  2. For the affected database, use the instructions in “Resetting a database’s “suspect” status” in the chapter “Other Useful Tasks” in the most recent version of Troubleshooting and Disaster Recovery guide to reset the status. Shut down and restart the server to complete recovery.

  3. The object named in the error message is still corrupted. To recover the data, follow the instructions in “How to rescue data from a corrupted table” in the chapter “Other Useful Tasks” in the most recent version of the of the Troubleshooting and Disaster Recovery guide to recover the data.

    NoteBe sure to perform step 3 before going to step 4. Otherwise, the next time you restart Adaptive Server, the error will reoccur in the database.

  4. Turn threshold accounting back on for the database affected by the 1142 error:

    1> use master
    2> go
    
    1> sp_dboption <database_name>, "no free space acctg", false
    2> go
    
    1> use <database_name>
    2> go
    
    1> checkpoint
    2> go
    

    Where <database_name> is the name of the database in the error message.


Incorrect OAM page entry in sysindexes

In this case, error 1142 is a serious error and may result in reading the wrong OAM page into the data cache and corrupting a buffer in the process.

Follow these steps to clear error 1142:

  1. Use the procedure described in “Finding an object name from a page number” in the chapter “Other Useful Tasks” in the most recent version of the Troubleshooting and Disaster Recovery guide to get dbcc page output for the page specified in the 1142 output.

    If the page status bits row has the value 0x8000, the page is a valid OAM page. If the value 0x8000 does not appear in the dbcc page output for the page status bits row, the page is not a valid OAM page and the object is corrupted.

    NoteIf the object is not corrupted, call Sybase Technical Support to determine why the 1142 error occurred.

  2. If the corruption is on a user table’s index (object ID is 100 or greater and index ID is between 1 and 250), run dbcc checktable to verify that the data page linking is good. If dbcc checktable runs cleanly, dropping and re-creating the index should clear the corruption.Use sp_helpindex to list all indexes on the table, then rebuild all the affected nonclustered indexes using one of two methods: :

    • If index ID is between 1 and 250, drop and re-create each nonclustered index on the table.

    or:

    • If a clustered index also exists on the table, drop and re-create it, which causes all nonclustered indexes to be automatically rebuilt. If your table is large, you may not have the space to do this (a rule of thumb is that 150 percent of your table size must be available).

  3. If the corruption is not on an index page, run dbcc tablealloc or dbcc checkalloc on the corrupted object. The output should report OAM allocation errors. Try to fix the reported allocation errors by referring to the information in this guide.

NoteIf these instructions do not correct the error, or the error persists, contact Sybase Technical Support.

Additional information

Before calling Sybase Technical Support, have the information available that is listed in “Reporting errors”, including output from dbcc page for the corrupted page and dbcc tablealloc or dbcc checkalloc for the corrupted object.

Versions in which this error is raised

All versions