I'm making a backup of a PostgreSQL 14 database from a remote server and restoring in another remote server. I'm using windows 10.
The backup:
pg_dump -h 10.10.10.10 -U postgres -Fc mydbname > myfilename
I also tried making the backup like this:
pg_dump -h 10.10.10.10 -U postgres --format=c mydbname > myfilename
And to restore:
pg_restore -h 10.10.10.10 -U postgres --clean -d mydbname < myfilename
I get this error: pg_restore: error: input file does not appear to be a valid archive
I also tried:
pg_restore --format=c -h 10.10.10.10 -U postgres --clean -d mydbname < myfilename
Error: pg_restore: error: did not find magic string in file header
I've been looking for this and tried all the answers to similar questions I could find here on Stackoverflow, none solved the issue. What am I doing wrong?
<.pg_dumpdid you use to do the dump? You can use newer versions ofpg_dumpto dump older Postgres versions and then restore to newer Postgres version. It does not work the other way around.pg_dump .... -f myfilenameandpg_restore .... myfilenameinstead