Search code examples
postgresqlpg-dumppg-restore

pg_restore giving an error (using default compression in pg_dump)


I did a pg_dump using this command -

pg_dump -U postgres -d dbtest --create -n dbtest -Fc | gzip -9 -c > /backup/dbtest.gz

I am trying to restore it using this command -

pg_restore -h myhostname -p 5432 -U postgres -d dbtest -Fc dbtest.gz &> Restore.log

But I am getting an error that states - [archiver] did not find magic string in file header


Solution

  • You have gzipped the file after backing it up. You need to unzip it first.