Обсуждение: refreshing a database with pg_dump and psql
Hi,
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
Thanks.
Maria A Rossi
Database Administration
PGDS (US)
email: maria.rossi@us.pgds.com
cell phone: 517.256.4392
work phone: 517.367.3099
work phone extension: 23099
Check the pg_restore manual. There is a "clean" option when using the custom format. I think this is what you are looking for.Hi,
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
Thanks.
Sorry, I mean to say, reload the database. Does that makes sense?
Maria A Rossi
Database Administration
PGDS (US)
email: maria.rossi@us.pgds.com
cell phone: 517.256.4392
work phone: 517.367.3099
work phone extension: 23099
From: David G. Johnston [mailto:david.g.johnston@gmail.com]
Sent: Tuesday, May 26, 2015 5:26 PM
To: Rossi, Maria
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] refreshing a database with pg_dump and psql
On Tuesday, May 26, 2015, Rossi, Maria <maria.rossi@us.pgds.com> wrote:
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
You should probably expound on what you mean by "refresh".
David J.
Check the pg_restore manual. There is a "clean" option when using the custom format. I think this is what you are looking for.Hi,
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
Thanks.
pg_restore -cC will do that, too.Check the pg_restore manual. There is a "clean" option when using the custom format. I think this is what you are looking for.Hi,
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
Thanks.
Or just inject a "DROP DATABASE ..." into the equation somewhere.
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
I think he meant to keep a development database in sync with the production database.
On Tuesday, May 26, 2015, Rossi, Maria <maria.rossi@us.pgds.com> wrote:I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
You should probably expound on what you mean by "refresh".David J.
I will try the pg_restore –cC or drop the database first.
Thank you all for the quick response.
Maria A Rossi
Database Administration
PGDS (US)
email: maria.rossi@us.pgds.com
cell phone: 517.256.4392
work phone: 517.367.3099
work phone extension: 23099
From: Jan Lentfer [mailto:Jan.Lentfer@web.de]
Sent: Tuesday, May 26, 2015 5:41 PM
To: David G. Johnston
Cc: Rossi, Maria; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] refreshing a database with pg_dump and psql
Am 26.05.2015 um 23:36 schrieb David G. Johnston <david.g.johnston@gmail.com>:
On Tue, May 26, 2015 at 2:27 PM, Jan Lentfer <Jan.Lentfer@web.de> wrote:
Am 26.05.2015 um 23:09 schrieb Rossi, Maria <maria.rossi@us.pgds.com>:
Hi,
I have a database that was created from a ‘pg_dump –C’. No problems there. Then I ran the pg_dump again, this time without the –C. and tried to load it. But got a bunch of ‘object already exist’.
Can’t I refresh an existing database from a plain pg_dump? Is there an option that I have to use?
Thanks.
Check the pg_restore manual. There is a "clean" option when using the custom format. I think this is what you are looking for.
Or just inject a "DROP DATABASE ..." into the equation somewhere.
pg_restore -cC will do that, too.
Jan