Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku pgbackups:restore: Invalid dump format

I have a local psql database dump that needs to be uploaded to heroku. I followed the steps in the Update section from this link. Everything worked fine until the last part, the actual uploading step:

heroku pgbackups:restore --app myAppName DATABASE 'https://www.dropbox.com/myAppPSQLDumpLink/myAppName_local.dump' --confirm myAppName

This was what was showing up in the console:

HEROKU_POSTGRESQL_SILVER_URL (DATABASE_URL)  <---restore---  myAppName_local.dump

Retrieving... done

 !    An error occurred and your restore did not finish.

And this was the error from the logs (courtesy of Toby Hede's question):

2013-01-09T15:39:09+00:00 app[pgbackups]: Invalid dump format: /tmp/GgUz5yU4bF/project_mgr_development_local.dump: HTML document text

I tried searching for this error, but could not find an answer. Does anyone know what needs to be done to solve the problem? The actual dump for my local psql database was performed this way:

pg_dump -Fc --no-acl --no-owner -U myUserName  > myAppName_local.dump

Thank you!

like image 309
AndraD Avatar asked Jan 09 '13 16:01

AndraD


People also ask

How do I backup a Heroku PostgreSQL database?

If you have multiple databases on your application, you can choose which one to backup by specifying the database name: $ heroku pg:backups:capture HEROKU_POSTGRESQL_PINK Hit Ctrl-C at any time to stop watching progress; the backup will continue running. Stop a running backup with heroku pg:backups:cancel.

What are the limitations of the pgbackups?

PGBackups are intended for moderately loaded databases up to 20 GB in size. Larger (or heavily loaded) databases, or database with large amounts of schemas or large objects may not be able to capture a logical backup before the backup process times out. Read more about the performance impact of logical backups.

How do I add a dump file to PG backups?

Dump your local database in compressed format using the open source pg_dump tool: In order for PG Backups to access and import your dump file you will need to upload it somewhere with an HTTP-accessible URL.

How do I import data into a Heroku application?

If you are importing data as part of the initialization of a new application you will need to first create and configure the app on Heroku before performing the import. Dump your local database in compressed format using the open source pg_dump tool:


2 Answers

Looks like the link to the dump on Dropbox is redirecting or pointing to an HTML page (HTML document text in the error). Visit the link and make sure you are directly getting the dump. Or download the dump in your browser, right-click on it and Copy Download Link. That link should work with pgbackups:restore.

like image 70
nathancahill Avatar answered Oct 24 '22 05:10

nathancahill


Dropbox provides an explanation for directly downloading files (https://www.dropbox.com/en/help/201) This can be helpful for using the dropbox links in pg_backups.

In short it says to have the download link with option "dl=1" rather than "dl=0". But this didn't work for me. Even copying the the address of downloaded file didn't work for me.

If you face the above problems, try moving the file into the public folder and copy the link from there. This worked for me.

like image 22
Jojjen Avatar answered Oct 24 '22 06:10

Jojjen