r/devops • u/ahmadpiran • Jul 19 '26
Ops / Incidents Does anyone actually test their database restores on a schedule?
Every backup thread ends with "an untested backup is not a backup," everyone upvotes, and then (in my experience) nobody has an automated restore test anywhere.
Genuinely curious about the state of practice:
- Do you restore-test on a schedule, or only when something breaks / an audit demands it?
- If you automated it, what did you build? (ephemeral instance? scripts like pgbackrest_auto? CI job?)
- If you didn't, what stopped you? (time? nowhere safe to restore to? nobody asked?)
- For those with SOC 2/ISO: did the audit change anything, or did you just produce a doc that says you test quarterly?
Trying to understand if this gap is real or if I just keep landing in teams that are bad at it.
---
Edit (Aug 27, 2026): this turned into a real tool. Built it, it's called restoredrill, MIT licensed: https://github.com/ahmadpiran/restoredrill. Posted the full writeup as its own thread here if you want the details: https://www.reddit.com/r/devops/comments/1vzvjdp/built_a_small_tool_to_test_that_postgres_backups/.
Thanks to everyone who chimed in, a good chunk of the actual design came straight out of this thread.
42
u/shelfside1234 Jul 19 '26
It’s a regulatory thing for me, needs to tested and evidenced yearly
Done manually
22
u/aenae Jul 19 '26
We restore the backup daily to a test database. Next we run a few tests on it and anonymize PI. After that we extract some data from it (50 most recent products, 50 best selling etc) and put it in a minimized database which is used for local development. The restored database can also be used for uat environments if they need all products for example.
If the restore fails, our testers will notice it
Database is mysql and the scripts for backup and restore are custom. We noticed that using the normal tools the backup and restore would take a day or two, and my scripts bring it down to a 2hr backup and an 8h restore. We have several tables with more than 2B rows, which are a pita to restore fast.
5
u/dbxp Jul 19 '26
They're meant to be tested, I'm sure our smaller single tenant ones are as it's not a big job the big multi tenant ones I'm not so sure about
3
u/mkmrproper Jul 19 '26
If I have the time to do it, I would. I get thrown into too many projects to even think about restoring backups for testing.
2
u/basedrifter Jul 19 '26 edited Jul 19 '26
Yes, and this is just what I set up for a homelab project using a Postgres/PostGIS database.
latest-successmanifest. It keeps local and NAS copies with retention; a failed configured NAS copy makes the run unhealthy.2
u/Arget19 Jul 19 '26
1
u/Wyrmnax Jul 19 '26
Last company I was in, we brought the production databases to homolog 3x per week. This was done automatically, we had routines to restore the backups during the night
So our production backup was being tested 3x per week, AND devs did not need access to production to solve almost anything.
BUT, this company was the exception. And it was something I pushed hard for, both because before it Devs needed way too much access to PRD, and because I had previous experiences with "oops, backup doesnt work"
1
u/tehpuppet Jul 19 '26
Weekly via Lambda and EventBridge. Spins up a backup, runs some SQL and posts the results to Slack.
1
u/quiet0n3 Jul 19 '26
We automated weekly restores and a bunch of validation queries.
Step function in AWS. Picks up latest snapshot of the RDS instance, kicks of a restore to a dedicated vpc (nothing else in it), once it's online we use a lambda function to run a bunch of tests, if everything passes it's will all get shutdown and cleaned up. Summary email sent.
Any if the validation fails it errors and alerts us to do an investigation.
1
u/fadingcross Jul 19 '26
Every night production db is pushed to staging for each client so that they have a fresh copy if they want to test something, and this is done from pulling the backup and pitr replay, so it also serves as testing restore procedure.
1
u/Floss_Patrol_76 Jul 19 '26
we run a restore into an ephemeral instance nightly and then diff row counts and run the app health checks against it, because a restore that 'succeeds' still lies to you all the time - the dump completes fine but a truncated blob column or a broken sequence only shows up when something actually reads it. the quarterly-doc version is theater; the only test that counts is one that exercises the data the way prod does.
1
u/Raja-Karuppasamy Jul 19 '26
honest answer to #3: solo founder, everything on supabase managed postgres. i’ve never done a restore test. told myself “it’s managed, they handle it” but i genuinely don’t know what my restore process even looks like if supabase gives me a dump and i’m on my own. reading this thread is mildly terrifying lol
the real blocker for me was #3’s “nowhere safe to restore to”, spinning up a second instance felt like effort and cost for something that might never happen. which i know is exactly the trap
1
u/xtreampb Jul 19 '26
I have automated jobs that restore the backup weekly, as a different name.
1
u/snarkhunter Lead DevOps Engineer Jul 19 '26
Daily. The difference between a backup verification and a backup restore is the difference between a transaction rollback versus commit.
1
u/ansibleloop Jul 19 '26
Action that restores the most recent backup, then tests it for consistency
We have to evidence that we at least do quarterly test restores (but mine are monthly and automated) and we have to do a disaster recovery test every year (manual-ish - just a case of running the DR action)
1
u/veritable_squandry Jul 19 '26
i used to work for a company that had an excellent management chain. i wrote cloud tools that performed and automated a simple restore test. it was great. that was 15 years ago. now nobody cares and i don't know why.
1
u/keto_brain Jul 19 '26
Yes, quarterly or 2x a year. Most companies I have worked for would do a full failover to another region or datacenter either quarterly or 2x a year. Before cloud, years before cloud or even VMWare when I was a Solaris admin I'd have to fly to Philly where Sunguard had a huge facility. I would have copies of all the most recent tapes sent to me from Iron Mountain, I would have to restore all the prod Solaris servers from Netbackup and tape, which at the time meant rebuilding the Netbackup index by importing every tape then restoring all the Veritas volumes, and then restoring /db_backup on the database servers, we would keep 3 days of backup on a SAN mount to /db_backup on the database servers.
Then I'd call the DBA team and they would restore the database, then we would run and to end test. I had to do all this in two days.
1
u/Posting____At_Night Jul 19 '26
I do a weekly restore of prod into a UAT database, and our dev db gets nuked every morning and repopulated from our schema scripts and test data generator.
It's kind of a janky setup but it does work, we're using SQL server hosted in RDS, and we have ADO pipelines running on a schedule to perform the restores/daily dev resets. I really want to move off of ado pipes for that stuff though and use ECS tasks or something instead so i'm not hogging pipeline agents for an hour when I do a restore.
1
u/krtalvis Jul 19 '26
our company has a required annual test that has to be conducted either manually or automatically, but evidence has to be provided and documented. Approved by ISO team in the end.
1
u/stewie410 Jul 19 '26
One of our product's staging env requires a nightly restore, but with a raw
db.sqldump, its taking ~18hr to do those restores. We're moving tomariadb-backupfor daily backup/restore, which seems like it'll cut that time down to ~2hr tops.Restore procedure in staging is a
bashscript ran bycronto get & restore the DB; followed by some additional queries to setup some staging-specific items not present in prod...As much as I'm an advocate for
bashscripts, including for complex automation -- I'm getting more annoyed with it as time goes on. But when my only other option is to do it withgroovy, well, I'm out of options.1
u/modern_medicine_isnt Jul 20 '26
We did as a startup, then we got bought by a big company. We didn't "own" the dbs anymore. When we asked about disaster recovery testing, they said... "what?" When we asked them to test restore a db, they sent us a quote to ask to finance for approval on. $10k. We stopped asking. Seems only small companies have to worry about such things.
1
u/marcusbell95 Jul 21 '26
yes, weekly automated. what we built: gitlab CI job runs every sunday night, spins up an ephemeral RDS postgres instance (db.t3.medium), restores from the latest pgbackrest base backup + WALs, runs a validation suite, destroys the instance. maybe $12-18 per run. validation is row counts on core tables, max timestamp on the main event log table (proves the backup is actually current, not just "a backup exists"), a few app-level queries that'd blow up if schema was corrupted. pass: instance destroyed + slack notification with duration and backup age. fail: instance stays alive for 4h so someone can log in and look. what blocked us for the first year was exactly your "nowhere safe to restore to" option - no staging env that matched prod in size, and duplicating RDS just for testing felt expensive. the thing that unlocked it: you don't need a permanent clone. spin up, test, destroy. for our volume it's about $15 for a sunday night run instead of $400/mo for a standing copy. SOC 2 note: our auditor responded better to this than the quarterly doc we used to submit. machine-generated pass/fail with timestamps stored in S3, backup age, restore duration - that's real evidence. "we test quarterly per our runbook" is a much weaker position.
1
u/DevOps-Op Jul 22 '26
we restore tested nightly for about a year, all green, felt great about it. then we actually lost a prod region and found out the fun way that our restore automation and the kms key the backups were encrypted with both lived in the same account we'd just lost. the backups were completely fine. we just couldn't get at them. the nightly test kept passing because it ran right next to a healthy prod with all the creds and keys sitting there, so it was quietly only ever testing the one scenario that never actually happens.
what changed my mind was doing a single restore into a totally separate account with nothing pre wired, fresh iam, no shared kms. took way longer and surfaced like four things the happy path never would have. turns out the restore working was never really the question, it was whether we could do it when everything around it was also on fire.
we still run the quick nightly one for the "did the dump come back clean" check. it's just not the thing i trust anymore.
1
u/themightybamboozler Jul 19 '26
Backups whose restores aren’t tested regularly are not backups they’re copium.
1
u/kennedye2112 Puppet master Jul 19 '26
It’s literally never happened in the almost decade I’ve been here.
1
u/stobbsm DevOps Jul 19 '26
Yes. How else do you know your backups work?
1
u/bendem Jul 19 '26
We do physical backups, restore every night to convert to logical dump just in case.
1
u/inferno521 Jul 19 '26
Yes, for SOC2 compliance
1
u/aprettyparrot Jul 22 '26
We did it like 20x a week in lab, first step of the mops we wrote are always taking backups, and restoring db was part of rollback which also had to be bulletproof
0
u/[deleted] Jul 19 '26
[deleted] — view deleted comment
0
u/[deleted] Jul 19 '26
[deleted] — view deleted comment