Backup & Restore

From: Charlie Clark <charlie(at)begeistert(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Backup & Restore
Date: 2007-08-06 14:35:41
Message-ID: B891027A-C2E3-4DAD-995F-92290DBE7BBE@begeistert.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a simple question that I can't find the answer to in the
documentation: how do I backup & restore a single database, ie. when
going from one cluster to another? I'm fairly comfortable with the
command line so I can create and restore backups but things do not
always work as expected.

pg_dump -U postgres -f my_database.dmp -F c my_database

now I want to restore this database to another system where a
database with the same name already exists (from production to
development):

According to the documentation the options -c and -a can be set on
pg_restore

ie.,
pg_restore -U postgres -c -d psytec psytec.dmp

should drop all the tables before recreating them but I get a load of
errors:
pg_restore: [archiver (db)] Error from TOC entry 1949; 2620 297386
TRIGGER RI_ConstraintTrigger_297386 postgres

using -a to restore data only means fewer errors as pg_restore exits
on the first error

Is the only way to drop the target database and recreate an empty
one? Or am I simply misreading the docs?

Thanks very much for any help.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-08-06 14:41:50 Re: Dealing with tsvector in fuctions for data split
Previous Message johnf 2007-08-06 13:33:30 Re: Modeling bill/ship addresses