public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Recovery Verification
Date: Tue, 24 Feb 2026 08:40:38 -0500
Message-ID: <CANzqJaDO2LOaAGiyvyQN54AJBs8BRZ1CkWXWTwPdG1WM7ttbBg@mail.gmail.com> (raw)
In-Reply-To: <8386a590-62e4-4ce9-8c62-37dfa496f464@Spark>
References: <8386a590-62e4-4ce9-8c62-37dfa496f464@Spark>

On Tue, Feb 24, 2026 at 1:12 AM <[email protected]> wrote:

> Hi folks,
>
> When performing database recovery tests, after restoring from backup is
> complete, what SOPs and tools do you use to sample your database contents
> and verify the data looks correct? Do you have a list of queries to run?
> What metadata do you capture and where do you save the test report? Do you
> use automation? Is it built in-house, off-the-shelf, or open-source?
>
> Thanks, I'm not a DBA but no one else works at my company so any pointers
> would be appreciated.
>

If using pg_backup/pg_restore, then something like this is perfectly
adequate:
pg_backup ... $DB 2> backup_$(date +"%F_%T").log || mail -s "ERROR: backup
failed at $(date +\"%F %T\")" [email protected]
pg_restore --exit-on-error ... $DB 2> restore_$(date +"%F_%T").log || mail
-s "ERROR: restore failed at $(date +\"%F %T\")" [email protected]

Then you know to check the log file to see what happened.

My business users don't trust that, so I created a simple, fast, imperfect
script which I run at the same time as the backup:
BEGIN;
SELECT COUNT(*) FROM table_1;
SELECT COUNT(*) FROM table_2;
...
SELECT COUNT(*) FROM table_N;
COMMIT;

Run the same script on the restored database.  The two log files have
always been identical.

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Recovery Verification
  In-Reply-To: <CANzqJaDO2LOaAGiyvyQN54AJBs8BRZ1CkWXWTwPdG1WM7ttbBg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox