How to duplicate the database in postgresql?
If you want to duplicate it within the same PostgreSQL install and you don't have actively connected users there's a handy shortcut:

CREATE DATABASE my_new_database TEMPLATE my_old_database;


or from the shell

createdb -T my_old_database my_new_database;


Otherwise you'll need to use pg_dump, createdb and pg_restore, e.g.

pg_dump -Fc -f olddb.pgdump -d olddb &amp;&amp;\
createdb newdb &amp;&amp;\
pg_restore -d newdb olddb.pgdump


If you're using nohup so the command doesn't die if you lose your ssh session, consider using screen instead.