I see lot of DBA’s still do not get the concept of Database backups and restore in terms of FULL/DIFF/TRANS Log Backups and Restores. I am not going to define what these mean (GOTO BOL), but rather talk about how these are useful and what to do with these fancy backup strategies.
Consider this example if you Database size is small enough (like 2-10GB) Because a bigger database size would take a diff backup strategy depending upon the time to backup and database size.
Considering your Database is in FULL Recovery Mode. (But Obvious) And I am only talking about a very simple scenario where you have a single file-group and simple backup processes. There are other various scenarios where you have multiple data files/multiple file-groups and if you are really Novice DBA then goto BOL to check for some basic lessons. Again anything presented here is a very generalized view of how to proceed with the restore process under a simple setup.
If you are taking a Daily FULL Database Backup / Differential Backup after every 6 Hours / Transaction Log Backups every 30 min’s.
What if a disaster Strikes (Disk Failure or someone hammers the server Or someone Flies his jet and tries to lands on the server) and you are tasked to recover the database Point in TIME or near about with minimum data Loss. What kind of Restores will a DBA consider a PLAN.
Restore the Latest FULL Backup. (WITH NORECOVERY)
Restore the Latest Differential Backup. (WITH NORECOVERY)
Restore the Transaction Logs Backups taken after the Differential Backup (WITH NORECOVERY) unless you are at the Last Transaction Log, then USE WITH RECOVERY to Bring the Database Online.
To Restore the Data to Point in time use (STOPAT= ‘’) while restoring the last transaction log.
The Latest Differential Backup will contain all changes that occurred since the last full backup, so no-need to restore the in-between differential backups unless there is a need otherwise to restore to other time/date.
The transaction logs will contain all the changes that occurred from the latest differential backup and thereafter each log back contains changes that occurred since last/latest transaction log backup.
So, here it is again:
Restore the Latest Full Backup WITH NORECOVERY
Restore the Latest Differential Backup WITH NORECOVERY
Restore the all the Transaction Log Backups since the Latest Differential Backup. WITH NORECOVERY unless you have reached the last transaction log, then use WITH RECOVERY.
Or if you Forget the WITH RECOVERY While restoring the latest Transaction Log Backup, you can still Bring the Database Online using RESTORE DATABASE <DATABASENAME> WITH RECOVERY;