Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failure using heroku pg:transfer

I'm trying to use heroku pg:transfer to transfer my local database to Heroku.

Here is the command that I'm running

heroku pg:transfer -f postgres://<username>:<password>@localhost:5432/<db_name> -t postgres://<app_path>.compute-1.amazonaws.com:5432/<stuff> --app <app_name> --confirm <app_name>

and I'm getting the following error messages

pg_restore: [archiver] did not find magic string in file header
pg_dump: [custom archiver] could not write to output file: Invalid argument
pg_dump: *** aborted because of error

I'm using Postgres on Windows. Does anyone know how to fix this?

like image 732
Jon Avatar asked Nov 28 '25 16:11

Jon


1 Answers

Import PG Backups can be used as a convenient tool to import database dumps from other sources to your Heroku Postgres database.

Dump your local database in compressed format using the open source pg_dump tool:

$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump

Import to Heroku Postgres

In order for PG Backups to access and import your dump file you will need to upload it somewhere with an HTTP-accessible URL. We recommend using Amazon S3.

Use the raw file URL in the pgbackups:restore command:

Be sure to use single quotes around the temporary S3 URL, as it contains ampersands and other characters that will confuse your shell otherwise.

like image 95
MZaragoza Avatar answered Nov 30 '25 13:11

MZaragoza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!