Tuesday, 27 October 2015 00:00

SQL FAQ – How Does A Page Level Restore Improve SQL Server Recovery Provisions?

Rate this item
(0 votes)

For very large Microsoft SQL Server databases, a complete restore operation can take many hours. During this time the database cannot be used to prevent data being entered and lost as information is copied back from tape or disk. Obviously in a high-availability environment any downtime is costly, so keeping it to a minimum is essential.

Fortunately page level restore techniques can be used to keep recovery times to a minimum by reducing the amount of data that needs to copied back from the backup media. Since the release of Microsoft SQL Server 2005, DBAs have had the option of carrying out a ‘page level restore’ which allows them to recover a ‘handful’ of pages, rather than having to restore entire datasets and copy information back into the original database.

The page level restore operation is perfect for situations where data becomes corrupted during writes through a faulty disk controller, misconfigured antivirus software or an IO subsystem. Better still, restore level operations can be performed online for Enterprise editions of Microsoft SQL Server.


As with any database recovery operation, page level restores are reliant on having a complete backup from which to work. If such a backup is not available, you will need to investigate an alternative method of recovering data from the server disks direct.

And although you can carry out the page level restore with the database online, you may decide to keep things safe by switching to single user mode whilst you transfer data using:


This command ensures that everyone is out of the system and cannot enter until you change the mode back again. You will also want to ensure that you have the end of the log file backed up so that you have all transactions fully accounted for and to prevent any further data loss:

TO DISK = N'X:\SQLBackups\DBName_TailEnd.trn'

Discovering which pages are corrupt

Usually the first sign that something is wrong will be an inconsistency error generated when a select statement is executed. The Microsoft SQL Server Messages pane will show an error like:

Msg 5242, Level 22, State 1, Line 1
An inconsistency was detected during an internal operation in database ‘DBName’(ID:9) on page (1:254).
Please contact technical support. Reference number 4.
As you would expect, the page number referenced, 254, is the corrupt page that needs to be recovered.

Carrying out a page level SQL Server recovery

The Microsoft SQL Server page recovery operation is very similar to that of a full recovery, the only difference being the use of the NORECOVERY command:

PAGE = 'fileid:pageid'  -- e.g. 1:254
FROM DISK = 'X:\SQLBackups\DBName_lastFull.BAK'

This will the re-insert the corrupted page from backup without going through the time-consuming process of a full SQL Server recovery. You can recover more than one page at a time simply by appending additional fileid:pageid combinations separated by commas.

You can test that the data has been recovered successfully by running DBCC CHECKDB on the affected database – it should complete without error.

Finishing up the page level SQL Server recovery

Although the corrupt page has been recovered successfully, you will also need to apply the transaction logs to ensure that all data is present and correct. For each transaction log generated since your last full backup, run the RESTORE LOG command:

FROM DISK = 'X:\SQLBackups\DBName_LogFileFrom2PM.TRN'
FROM DISK = 'X:\SQLBackups\DBName_LogFileFrom215PM.TRN'

Again, note the NORECOVERY option will ensure that you restore nothing but the specified log files. Finally you need to apply the tail log backup taken in the Prerequisites section above:

FROM DISK = 'X:\SQLBackups\DBName_TailEnd.trn

This time you do want to recover the database, hence the WITH RECOVERY command.

At this point you can re-test the database to ensure that everything is working as it should. Once you are satisfied, switch the database back to multi-user mode to restore access for your users:


And there you have it, corruption problems resolved without having to undergo a full SQL Server recovery. The page level restore option ensures that downtime and user inconvenience is kept to a minimum, as are the costs associated with a database outage.

Reference :http://blog.krollontrack.co.uk/concepts-explained/sql-faq-how-does-a-page-level-restore-improve-sql-server-recovery-provisions/

Last modified on Tuesday, 27 October 2015 10:57
Data Recovery Expert

Viktor S., Ph.D. (Electrical/Computer Engineering), was hired by DataRecoup, the international data recovery corporation, in 2012. Promoted to Engineering Senior Manager in 2010 and then to his current position, as C.I.O. of DataRecoup, in 2014. Responsible for the management of critical, high-priority RAID data recovery cases and the application of his expert, comprehensive knowledge in database data retrieval. He is also responsible for planning and implementing SEO/SEM and other internet-based marketing strategies. Currently, Viktor S., Ph.D., is focusing on the further development and expansion of DataRecoup’s major internet marketing campaign for their already successful proprietary software application “Data Recovery for Windows” (an application which he developed).


  • Comment Link Cecile Saturday, 20 January 2018 03:52 posted by Cecile

    Thanks for the auspicious writeup. It in reality used to be a amusement account it.
    Glance advanced to more brought agreeable from you! However,
    how could we communicate?

  • Comment Link Magda Friday, 19 January 2018 13:45 posted by Magda

    Thanks for one's marvelous posting! I genuinely enjoyed reading it, you could be a great author.I will ensure that I bookmark your blog and will
    eventually come back down the road. I want to encourage continue your great job, have
    a nice morning!

  • Comment Link Kina Sunday, 14 January 2018 23:24 posted by Kina

    After I originally left a comment I appear to have clicked
    on the -Notify me when new comments are added- checkbox and now each time a
    comment is added I receive four emails with the same comment.
    There has to be an easy method you are able to remove me from that service?

  • Comment Link Neville Sunday, 14 January 2018 06:04 posted by Neville

    Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog
    that automatically tweet my newest twitter updates.
    I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something
    like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your
    new updates.

  • Comment Link Marcelino Thursday, 11 January 2018 07:06 posted by Marcelino

    Thanks for sharing your info. I truly appreciate your efforts and I am waiting for your next post thank you once

  • Comment Link Sylvia Thursday, 07 December 2017 09:25 posted by Sylvia

    Touche. Outstanding arguments. Keep up the amazing work.

  • Comment Link Manual Thursday, 16 November 2017 09:09 posted by Manual

    Do you got slipping balcony door in your abode?

  • Comment Link Heidi Monday, 13 November 2017 17:27 posted by Heidi

    Very good post. I'm dealing with some of these issues as well..

  • Comment Link Adolph Sunday, 12 November 2017 06:08 posted by Adolph

    Admiring the hard work you put into your website and in depth information you provide.

    It's good to come across a blog every once in a
    while that isn't the same out of date rehashed material.
    Wonderful read! I've saved your site and I'm adding your RSS feeds to my Google account.

  • Comment Link Mitchel Sunday, 12 November 2017 04:37 posted by Mitchel

    We are a group of volunteers and opening a new scheme in our community.
    Your site provided us with valuable information to work on. You've done a formidable
    job and our entire community will be thankful to you.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.