Page Restore

  • Consider the following scenario:

    I created a database named ABC which has a table named example having only one column named id whose datatype is varchar(2000).

    It contains the following data:

    A............2000 times

    B............2000 times

    C............2000 times

    I backed up the database and took it offline.

    How can the following tasks be achieved?

    I need to introduce some corruption into the data file using a notepad editor:open the data file, search for the page with the As and change one byte to a ‘B’ or ‘Z’ or something not an A.

    User reads the page with the row of ‘C’s with no problem, but when they try to read page with the row of As they get a checksum error.

    How the Page Restore functionality works?

    Any help would be appreciated.

    With Thanks,

    Satnam

  • DB has to be in full or bulk logged recovery, you need a full backup from before the corruption happened.

    http://msdn.microsoft.com/en-us/library/ms175168.aspx

    http://blogs.msdn.com/b/sqlserverstorageengine/archive/2007/01/18/fixing-damaged-pages-using-page-restore-or-manual-inserts.aspx

    p.s. Notepad will choke on a database file. Download a hex editor, there are lots of free ones for Windows, and use that.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Many Thanks for that Gail. Any idea about how i introduce corruption into the data file manually,search for the page with the As and change one byte to a ‘B’ or ‘Z’ or something not an A.

  • singhsatnam84 (6/29/2010)


    search for the page with the As and change one byte to a ‘B’ or ‘Z’ or something not an A.

    Yup, that'll do the job. It'll invalidate the page checksum and result in an 824 error as soon as something read that page.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply