0

Suppose a dump is provided from pgdumpall

pg_dumpall > outfile.bkp

How to verify if the outfile is a vaild database file for restoration. Just as a precautionary step before restoring it like

psql -f outfile.bkp postgres

For example: In MySQL we can head first few lines of the backup files produced from mysqldump for having SQL like syntax.

  • 1
    If pg_dumpall did not result in an error you can be certain the file is valid. – a_horse_with_no_name Sep 11 '19 at 12:39
  • What if it is provided by application team and System DBA has to restore it – Big Data DBA Sep 11 '19 at 12:58
1

The command you show generates a text backup file. You can use "head" or "less" on it to verify that it looks like a PostgreSQL text backup file, same as mysql. I'd also run "tail", just to make sure it didn't get truncated. It should end with a sign-off like:

--
-- PostgreSQL database dump complete
--

--
-- PostgreSQL database cluster dump complete
--

Of course to be really sure, you would just set up a dummy database server, and restore it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.