Skip navigation

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

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.


TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish