Pcornel
Databases · Backup, Restore & Recovery

Point-in-Time Recovery

Cheat sheet · https://pcornel.dk/topic.php?topic=6185

Back to the Topic

Answer

Point-in-time recovery restores a base backup and replays logs (WAL, binlog, transaction log) up to a chosen moment, e.g. just before a bad change.

Remember

Requires continuous, complete log archiving since the base backup. Restore to a separate instance first, extract data, and avoid overwriting production blindly.

First checks

  • SELECT * FROM pg_stat_archiver; — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version

Verify in this order

base backup → restore → replay logs to target time → open

Where it usually breaks

A missing log segment stops recovery at that point.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6185

Confirmation

Confirm action

Continue?