Jon
Jon

Reputation: 4045

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?

Upvotes: 3

Views: 1005

Answers (1)

MZaragoza
MZaragoza

Reputation: 10111

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.

Upvotes: 1

Related Questions