Advertisement
Intermediate SQL Server, Backup & Recovery

How would you perform a point in time restore to recover a database to the exact moment just before an accidental data deletion?

Short answer

You restore the most recent full backup with the NORECOVERY option, then restore any differential backup if one exists, and finally restore the transaction log backups in order, using the STOPAT option on the final log restore to specify the exact date and time just before the…

Save SQL Server mock interview
Advertisement
AModel answer
You restore the most recent full backup with the NORECOVERY option, then restore any differential backup if one exists, and finally restore the transaction log backups in order, using the STOPAT option on the final log restore to specify the exact date and time just before the accidental deletion occurred.
RESTORE DATABASE MyDatabase FROM DISK = 'Full.bak' WITH NORECOVERY;
RESTORE LOG MyDatabase FROM DISK = 'Log1.trn' WITH NORECOVERY;
RESTORE LOG MyDatabase FROM DISK = 'Log2.trn' WITH STOPAT = '2026-09-06 14:30:00', RECOVERY;
Real-world example
A finance team accidentally deletes an important table of transactions at 2:35pm, and the database administrator restores the database to 2:30pm using a point in time restore, recovering all the lost data with minimal impact.
Likely follow-ups
  • What happens if you specify a STOPAT time that is after the last available transaction log backup?
  • Why is the order of restoring full, differential, and log backups important?
Related topics