CrazySQL

Understanding SQL Server Database Restore Process

Posted by: Manpreet Singh on: June 1, 2009

Restore is very important part of whole database administration process. Understanding the internal working of restore process helps administrators to create disaster recovery processes for organizations. Restoring a SQL database is the process of using full or differential backup files and their subsequent Transaction log files to roll the database forward to a certain point. Recovery is the overall set of Processes that SQL Server runs to ensure that the database is in a consistent state when it is brought online, which might include such processes as rolling back uncommitted transactions.

Restore is a multi-phase process and include three main phases: data copy, redo, and undo.

Data Copy Phase

During this phase of restore, the contents of the database, files, or pages being restored are initialized          the data is then copied from one or more full backups and, optionally, differential backups, and then resetting the contents of the affected database, files, or pages to the time that they were captured by those backups. The oldest file used in the backup set of files (also known as the roll-forward set) will contain the LSN for the redo phase.

Redo Phase

The redo phase is also known as the roll-forward phase. This is when the transaction logs are processed to ensure the consistency of your databases. If you specified a specific point in time to recover to (date or marked transaction), this will be done in the redo phase. Even with all things rolled forward that have been committed, there might still be some uncommitted transactions. Also, Restore avoids unnecessary roll forward. Generally, if data was read-only when it was backed up and has remained read-only, roll forward is unnecessary and is skipped.

Undo Phase

Undo is the last step in ensuring the consistency of your database. In this phase, any changes made by uncommitted transactions are undone, or rolled back. At the end of undo, no more backup files can be processed, and the database is brought online. Undo will not be done if WITH NORECOVERY is specified. Also, If the data is already transactionally consistent at the start of the recovery process, the undo phase is skipped. After the database is transactionally consistent, recovery brings the database online.

2 Responses to "Understanding SQL Server Database Restore Process"

Nice article dear.
Is there way to backup data from remote server to local pc and attach this backup to local sql server(2005 or 2008)?

ya , the same can be achieve by using log- shipping . or you can use custom code to backup the database, copy it to local computer and then restore the database to local computer.

Leave a Reply

View Manpreet Singh's profile on LinkedIn





 

June 2009
M T W T F S S
« May   Jul »
1234567
891011121314
15161718192021
22232425262728
2930