Clone a Postgresql Database

May be there are more efficient ways of doing this, but I could only found following procedure:
1) Create a new DB
   createdb -U db_user new_db_name
2) Dump data from original DB
  pg_dump -U db_user -Fc original_db_name > dump_file_name
3) Restore to new db
   pg_restore -U db_user -d new_db_name dump_file_name

Leave a Reply

Your email address will not be published. Required fields are marked *