Re: [SQL] How to duplicate postgres 9.4 database

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: [SQL] How to duplicate postgres 9.4 database
Дата
Msg-id CY1PR07MB23803BD5BF9952CF8865348DDAA40@CY1PR07MB2380.namprd07.prod.outlook.com
обсуждение исходный текст
Ответ на [SQL] How to duplicate postgres 9.4 database  (srilinux <srilinux09@gmail.com>)
Ответы Re: [SQL] How to duplicate postgres 9.4 database
Список pgsql-sql
-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of srilinux
Sent: Friday, July 21, 2017 3:29 PM
To: pgsql-sql@postgresql.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
connectto 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






В списке pgsql-sql по дате отправления:

Предыдущее
От: srilinux
Дата:
Сообщение: [SQL] How to duplicate postgres 9.4 database
Следующее
От: srilinux
Дата:
Сообщение: Re: [SQL] How to duplicate postgres 9.4 database