3

I have a db dump in pg from heroku. I want to use that db locally as well.

How can we have that database dump imported locally using pgadmin

3 Answers 3

7

You can create a database in PG and make the dump import to that database

$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [database name] latest.dump

For references you can view this blog: https://cbabhusal.wordpress.com/2016/01/22/heroku-postgresql-dump-production-staging-database-to-localhost/

Sign up to request clarification or add additional context in comments.

6 Comments

how do I specify the path of latest.dump. It is under my home directory
You can do ~/ as it defines our home directory
could not open input file "/home/suraj/database.dump": No such file or directory this is what I am getting with pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [sur] -d [development_db] ~/database.dump
I ve not tried with using paths. Always dumped the database in the project directory itself. But let me try again
Are you still having problem?
|
0

Use this command for restoring

'pg_restore -i -h localhost -p 5432 -U postgres_user_name -d database_name -v “LATEST_DUMP_PATH”'

Comments

0

I use the following, simple and to the point:

pg_restore -d database_name -c ~/database.dump

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.