How can I recover data from a SQL table that is corrupt with a bad page/pointer?

Neil Pike

July 27, 1999

1 Min Read
ITPro Today logo

A. Assuming only one page is bad, then it isn't too bad. If there are lots then this process must be amended to do random selects above the low key to find the next good page each time.

1) Do a SELECT key FROM table, and note the last key value (low key) returned when it fails.
2) Do a SELECT key FROM table ORDER BY key DESC, and note the last key (high key) again.
3) Create a "dummy" table with the same structure
4) Insert rows into the "dummy" table with key values less than or equal to the low key.
5) Insert rows into the "dummy" table with key values greater than or equal to the high key.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like