pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedPostgresql Duplicate DB
3+ messages / 3 participants
[nested] [flat]
* Postgresql Duplicate DB
@ 2019-02-11 11:09 Sathish Kumar <satcse88@gmail.com>
2019-02-11 11:16 ` RE: Postgresql Duplicate DB Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
2019-02-11 11:16 ` Re: Postgresql Duplicate DB Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 2 replies; 3+ messages in thread
From: Sathish Kumar @ 2019-02-11 11:09 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi All,
I would like to duplicate our existing db on the same server, what will be
the faster way to achieve it.
DB size is around 300gb.
^ permalink raw reply [nested|flat] 3+ messages in thread
* RE: Postgresql Duplicate DB
2019-02-11 11:09 Postgresql Duplicate DB Sathish Kumar <satcse88@gmail.com>
@ 2019-02-11 11:16 ` Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
1 sibling, 0 replies; 3+ messages in thread
From: Alvaro Aguayo Garcia-Rada @ 2019-02-11 11:16 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org; Sathish Kumar <satcse88@gmail.com>
Hi. Not sure if the fastest, but the first that comes up to my mind is using pg_dump and psql. First you create your new database, then you run this(replacing as needed):
pg_dump OLDDB | psql NEWDB
Saludos,
Alvaro Aguayo
Jefe de Operaciones
Open Comb Systems E.I.R.L.
Oficina: (+51-1) 3377813 | Cel.: (+51) 995540103 | RPC: (+51) 954183248
Website: www.ocs.pe
Sent from my Sony Xperia™ smartphone
---- Sathish Kumar wrote ----
Hi All,
I would like to duplicate our existing db on the same server, what will be
the faster way to achieve it.
DB size is around 300gb.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Postgresql Duplicate DB
2019-02-11 11:09 Postgresql Duplicate DB Sathish Kumar <satcse88@gmail.com>
@ 2019-02-11 11:16 ` Laurenz Albe <laurenz.albe@cybertec.at>
1 sibling, 0 replies; 3+ messages in thread
From: Laurenz Albe @ 2019-02-11 11:16 UTC (permalink / raw)
To: Sathish Kumar <satcse88@gmail.com>; pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-02-11 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 11:09 Postgresql Duplicate DB Sathish Kumar <satcse88@gmail.com>
2019-02-11 11:16 ` Alvaro Aguayo Garcia-Rada <aaguayo@opensysperu.com>
2019-02-11 11:16 ` Laurenz Albe <laurenz.albe@cybertec.at>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox