Demo: restoring to five minutes before a bad DELETE
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
perform a PITR end to end.
Draft outline details
Step by step
- Enable WAL archiving and take a base backup; write down the time.
- Run workload, note a safe timestamp, then run
DELETE FROM orderswithout aWHEREclause. - Stop the server and move the damaged data directory aside; restore the base backup.
- Set
recovery_target_timeto five minutes before the delete, createrecovery.signal, and start. - Planned mistake: target a time after the delete; the rows are gone again. Fix: choose an earlier target and repeat.
- Verify row counts, promote, and record the elapsed recovery time.
Prepares MID-018-LAB1.
Check your understanding
Why recover to a time before the delete rather than after?
Show answer
Replay stops at the target, so the delete is never applied.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.