I'm looking to copy a production PostgreSQL database to a development server. What's the quickest, easiest way to go about doing this?
Postgresql – Copying PostgreSQL database to another server
databasepostgresql
Related Topic
- PostgreSQL: Show tables in PostgreSQL
- Sql – Save PL/pgSQL output from PostgreSQL to a CSV file
- Postgresql – Import SQL dump into PostgreSQL database
- Postgresql – How to start PostgreSQL server on Mac OS X
- PostgreSQL error: Fatal: role “username” does not exist
- Postgresql – Which version of PostgreSQL am I running
Best Answer
You don't need to create an intermediate file. You can do
or
using
psql
orpg_dump
to 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_dump
is for backing up andpsql
is 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