I'm looking to copy a production postgres database to a development server. What's the quickest, easiest way to go about doing this?
|
closed as off topic by Dave Jarvis, Jan Hančič, Don Roby, Veger, Mr. Alien Dec 24 '12 at 11:15
Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.
You don't need to create an itermediate file. You can do
or
Using psql or pg_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. Edit As porneL said there is no need to dump to a intermediate file, if you want to work compressed you can do with a compressed tunnel .
or pg_dump -C dbname | ssh -C remoteuser@remotehost "psql dbname" But this solution also requires to get a session in both ends. |
|||||||||||||
|
Then copy the backup to your development server, restore with:
|
|||||||||
|
Use pg_dump, and later psql or pg_restore - depending whether you choose -Fp or -Fc options to pg_dump. Example of usage:
|
|||
|
For PostgreSQL you can use either of these operations
|
||||
|