Re: Postgresql Duplicate DB - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Postgresql Duplicate DB
Date
Msg-id f596dc37f9e2a3a28b382cc8d7dbe51f26d9d415.camel@cybertec.at
Whole thread Raw
In response to Postgresql Duplicate DB  (Sathish Kumar <satcse88@gmail.com>)
List pgsql-general
Sathish Kumar wrote:
> I would like to duplicate our existing db on the same server, what will be the faster way to achieve it.

If it is in the same database cluster, you can use

   CREATE DATABASE newdb TEMPLATE olddb;

Make sure nobody is connected to "olddb" when you do that.

If you want to clone a whole database cluster, you can run

   pg_basebackup -D /new/cluster/directory --wal-method=stream

and recover the new cluster with "restore_command = 'true'".

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com



pgsql-general by date:

Previous
From: Alvaro Aguayo Garcia-Rada
Date:
Subject: RE: Postgresql Duplicate DB
Next
From: Alvaro Aguayo Garcia-Rada
Date:
Subject: Re: bdr replication breaks down