[GENERAL] Copy database to another host without data from specific tables

Поиск
Список
Период
Сортировка
От Panagiotis Atmatzidis
Тема [GENERAL] Copy database to another host without data from specific tables
Дата
Msg-id EB4E164C-786A-420A-AEA4-264DE8459561@convalesco.org
обсуждение исходный текст
Ответы Re: [GENERAL] Copy database to another host without data fromspecific tables  (Condor <condor@stz-bg.com>)
Re: [GENERAL] Copy database to another host without data fromspecific tables  (Condor <condor@stz-bg.com>)
Re: [GENERAL] Copy database to another host without data fromspecific tables  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Re: [GENERAL] Copy database to another host without data fromspecific tables  (Vick Khera <vivek@khera.org>)
Список pgsql-general
Hello,

I have 2 RDS instances on AWS running PSQL 9.4.7.

I want to make a clone of database1 which belongs to user1, to database2 which belongs to user2. Database1 has 20+
tables.I want to avoid copying the DATA sitting on 5 tables on database1 (many Gigs). 

I've read one too many posts about how to perform the actions with "pg_dump" and "pg_restore" but I'm trying to figure
outthe easiest way to do this. The process I have in mind is this: 

1) pg_dump the schema from DB1 to DB2 using --no-owner and pg_restore with --role=user2
2) pg_dump -Fc --no-owner --data-only -t 'table1' from DB1 and then restore with pg_restore -t 'table' --role=user2
<table.sql>to DB2 

This procedure though is very time consuming (although it could be scripted). Is there any better / faster / safer way
todo this? 

Thanks.

--
Panagiotis (atmosx) Atmatzidis

email:    atma@convalesco.org
URL:    http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

"Everyone thinks of changing the world, but no one thinks of changing himself.” - Leo Tolstoy







Вложения

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

Предыдущее
От: Günce Kaya
Дата:
Сообщение: Re: [GENERAL] Fwd: parameter type is unknown error
Следующее
От: Condor
Дата:
Сообщение: Re: [GENERAL] Copy database to another host without data fromspecific tables