From: | Igor Neyman <ineyman(at)perceptron(dot)com> |
---|---|
To: | srilinux <srilinux09(at)gmail(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to duplicate postgres 9.4 database |
Date: | 2017-07-21 20:07:33 |
Message-ID: | CY1PR07MB23803BD5BF9952CF8865348DDAA40@CY1PR07MB2380.namprd07.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of srilinux
Sent: Friday, July 21, 2017 3:29 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] How to duplicate postgres 9.4 database
Hi All
I want to duplicate the existing database , after reading documentation I used below command which just created database, but did not create data
CREATE DATABASE standby TEMPLATE template0;
my database is 35gb so dump and psql will take longer hours
is there an fastest way to copy database on same server , so that I can just modify pointing to the database and connect to the stanby one to do any testing ?
__________________________________________________________________________________________________________
As a TEMPLATE you should use the db that you want to copy, let's call it "source_db":
CREATE DATABASE standby TEMPLATE source_db;
Be aware, that when this statement runs there should be no user connections to source_db.
Regards,
Igor Neyman
From | Date | Subject | |
---|---|---|---|
Next Message | srilinux | 2017-07-22 23:43:43 | Re: How to duplicate postgres 9.4 database |
Previous Message | srilinux | 2017-07-21 19:28:55 | How to duplicate postgres 9.4 database |