0

So there's a database on a dev machine server that I ssh into to write code. I want to copy the database from there to my local machine. But I can't get the following to work. Can you tell me what's wrong and where to go from here? (See image)enter image description here

2
  • 1
    So just ssh into that machine and run pg_dump locally, then copy the files to your computer with scp Commented May 10, 2016 at 5:28
  • Where would it put that file? Is it this command? Backup: $ pg_dump -U {user-name} {source_db} -f {dumpfilename.sql} Commented May 10, 2016 at 5:30

1 Answer 1

1

You could do the following to transfer it across with pg_dump:

ssh blau08@blau08 'pg_dump -C fieldfacts' | psql template1

This way you run pg_dump on the remote server, and direct the output to your locally-running psql. This system is effective for large databases, since it doesn't create any intermediate files, and is (relatively) fast and secure. If the database is large, compressing the output and using [email protected] may improve performance (ssh -C -c [email protected] ...)

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

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.