How do I restore my Heroku pg_dump on DigitalOcean? Simply-put, I'm trying to copy my database from a Heroku server over to my new DigitalOcean server.

This is what I've done so far:


Download (custom format) backup via Heroku
Upload the dump file to DigitalOcean
pg_restore -d postgres -1 /etc/postgresql/9.5/main/a190c52e-15f6-4fab-8a14-323275c6e174


... And then I get errors...

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 213; 1259 17190747 TABLE account_account rknsgnrsrzgwiv
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "account_account" already exists
    Command was: CREATE TABLE "public"."account_account" (
    "id" integer NOT NULL,
    "timezone" character varying(100) NOT NULL,
    "la...
It looks like you have already restored this data once before, so the objects already exist.  And trying to load it into the database named 'postgres' is a dubious practice anyway.

You should create a new database with a different name and load the data into that new database instead of into 'postgres'.  Or maybe you meant to use the -C option, in which case it will create and use the database which is named inside the dump file as the database to load the data into (in which case the database named in -d is only used to connect to in order to issue the CREATE DATABASE command).

If you really want to load this data to the database named 'postgres', you could use the -c option (without -C), which will drop the existing objects before recreating them.