0

I am using this command to attempt to transfer a DB

pg_dump -C -h localhost -U OLD_SERVER_USER_NAME site_db | psql -h NEW_SERVER_IP -U postgres site_db

It asks me for a password, which I give and then nothing happens, it just hangs.

What am I doing wrong?

Christopher Reid
  • 4,318
  • 3
  • 35
  • 74

1 Answers1

1

First, to avoid the password prompt, you can set the environment variable PGPASSWORD.

In terms of it hanging, it's quite possible that the piping is "eating" an error that you would otherwise see.

Try breaking it up into separate commands, something like:

pg_dump -C -h localhost -U OLD_SERVER_USER_NAME site_db > db.dmp.sql && psql -h NEW_SERVER_IP -U postgres -f db.dmp.sql site_db

And see if you get any errors from either command.

khampson
  • 14,700
  • 4
  • 41
  • 43
  • I ended up manually transferring the DB using the answer in this post. http://stackoverflow.com/questions/12233046/django-permission-denied-when-trying-to-access-database-after-restore-migratio . Thanks for your help though. – Christopher Reid Jun 18 '14 at 23:45