I’m looking to copy a production PostgreSQL database to a development server. What’s the quickest, easiest way to go about doing this?
I’m looking to copy a production PostgreSQL database to a development server. What’s the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need to create an intermediate file. You can do
or
using
psqlorpg_dumpto connect to a remote host.With a big database or a slow connection, dumping a file and transfering the file compressed may be faster.
As Kornel said there is no need to dump to a intermediate file, if you want to work compressed you can use a compressed tunnel
or
but this solution also requires to get a session in both ends.
Note:
pg_dumpis for backing up andpsqlis for restoring. So, the first command in this answer is to copy from local to remote and the second one is from remote to local. More -> https://www.postgresql.org/docs/9.6/app-pgdump.html