Quick quote


Please do not contact Neubreed offering recruitment OR outsourcing services

To request a call back to discuss your project, please complete this form.

Alternatively, please call: (02) 8007 0218

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Drupal website specialists. Call us about your project on (02) 8006 3402

How to copy a Postgres database

Posted 03/February/2011 by neubreed

To make a copy a Postgres database, log into a SSH terminal and issue the following commands. pg-user-name is the postgres database user name in these examples, so yours may differ

First dump a copy of the table to a file

pg_dump -U pg-user-name -c db_name > db_name_dump

Then create a new database

createdb -U pg-user-name db_name_2010

Then import the previously dumped file into the new database

pgsql -U pg-user-name db_name_2010 < db_name_dump