pg_restore: [archiver] did not find magic string in file header
34
votes
4
answers
67254
views
I'm using PostgreSQL 9.1 and want to restore backup files generated with
pg_dump
:
sudo pg_dump -h 127.0.0.1 -U postgres --clean --inserts -E UTF8 -f out.sql database_name
This command generates a valid sql file that starts with droping any existing database objects, then generates all tables, indizes, sequences and so on, and finally inserts data.
When I try to restore the generated backup file with: (line breaks added for display purposes only)
sudo pg_restore
-d database_name -h 127.0.0.1 -U postgres
--format=c --clean --create out.sql
it fails and prints:
pg_restore: [archiver] did not find magic string in file header
What is the reason for that?
Asked by maja
(443 rep)
Aug 22, 2015, 10:06 AM
Last activity: Feb 28, 2023, 06:44 PM
Last activity: Feb 28, 2023, 06:44 PM