Sunday, January 17, 2010

Database Recovery phases

There are 3 phases to a database recovery:

1. Data Copy: Involves copying all data, log, index pages from the backup file/media to the databases files.

2. Redo/Roll-forward: Involves applying the logged transactions to the data copied from the backup to roll forward that data to the recovery point. This includes uncommitted data too; therefore, the database is in an inconsistent state.

3. Undo: Involves rolling back the uncommitted transactions, bringing the database in a consistent state.

Finally, the Recovery brings the database online for users.


When NORECOVERY option is used, the restore process only completes the 1 phase - Data Copy. Therefore, neither committed transactions are rolled forward nor uncommitted transactions are undone/rolled back.