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?
IntermediateAnswer
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.