HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Can't restore my distribution DB postgres 9.2 backup into my staging DB postgres 9.3

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canpostgresintostagingdistributionrestorebackup

Problem

I keep getting this pg_restore: [archiver] did not find magic string in file header when i execute a pg_restore -Fc -U "username" -d "dbname" "filename".dmpon my staging DB.

These DB are running on two separate AWS instances with windows server 2008 for both environments(staging and distribution). The postgres version used on distribution is the 9.2 and the version on staging is 9.3.

I think this issue could be related to the fact that i get several pg_dump: [custom archiver] WARNING: ftell mismatch with expected position -- ftell used warnings when i execute a pg_dump -Fc -U "username" -w "dbname" > "filename".dmp on the distribution DB.

Any help is appreciated.

Solution

I found several bug reports indicating that pg_dump has problems writing to a pipe on Windows:

  • BUG #7794: pg_dump: errors when using pipes/streams



  • BUG #6726: pg_dump - ftell mismatch when using -Fc and split



Instead of writing to stdout and redirecting to a file, try using -f specify the output file:

pg_dump -Fc -U "username" -w "dbname" -f "filename".dmp

Code Snippets

pg_dump -Fc -U "username" -w "dbname" -f "filename".dmp

Context

StackExchange Database Administrators Q#59950, answer score: 12

Revisions (0)

No revisions yet.