Re: Copy one database to another server - Mailing list pgsql-admin

From bricklen
Subject Re: Copy one database to another server
Date
Msg-id CAGrpgQ9R-_cD5DDYgfZzfjvaNW0pAQd8P=oPhRrtnND-oa9gbA@mail.gmail.com
Whole thread Raw
In response to Copy one database to another server  (Huan Ruan <huan.ruan.it@gmail.com>)
List pgsql-admin
On Thu, May 2, 2013 at 3:01 PM, Huan Ruan <huan.ruan.it@gmail.com> wrote:
  • create a new db using the current one as a template. Easy to do and speed is acceptable. A bit downtime is ok, but it's only on the current server. Is there a way to move it to anther server?

FWIW, I recently set up a 160GB clone by simply piping from pg_dump over the network into psql, alleviating the need to dump to disk. In my case, the server did not have enough space to hold the pg_dump, so I had to stream it.

pg_dump -Fp your_db | psql -h new_server -U postgres your_new_db

You could also search the archives for caveats and other (and safer) ways to do this.

pgsql-admin by date:

Previous
From: Steve Crawford
Date:
Subject: Re: Copy one database to another server
Next
From: Nghia Truong
Date:
Subject: Problem: pg_hba.conf is automatically rewritten every day