Yes I know, there are lots of articles and posts about this topic. But I want to show, what are things to be known to recover the database to specific point-in-time.
Backup
As you know there are 3 recovery models supported in MS SQL server.- Simple
- Automatically clear the log file.
- Only allows recover to end of a backup.
- No log backups
- Full
- Requires log backups
- No work is lost, if data (.mdf) file get damaged/lost
- Can recover to a specific point-in-time.
- Bulk-logged
- Requires log backups
- Use minimal logging for bulk operations, thereby reducing the log space
- Point-in-time recovery is not supported.
In a mission critical environment, Full recovery model is the most recommended. In this post I’m paying attention to this model and simply explain point-in-time recovery.
From your SQL server database you can take, 3 back up types. - Full
- Differential
- Transaction Log
You can see in the Figure 1, Full backup will take all the data from start to the end(let say T1). On the other hand Differential backup will take care of data from last successful Full backup(always) to the end. Whereas, Transaction Log back up will incrementally takes data in subsequent attempts from where the last successful transaction log was taken to the end of the log. By considering this you can create a backup strategy for your database. It has to be more serious when you are dealing with large and mission critical database. In a little later, I will explaining about restoring of database which will helps you to design the backup strategy.
Here is the T-SQL statements for