From: Tom Lane <tgl@sss.pgh.pa.us>
To: admin@usachurch.com
Cc: pgsql-admin@postgresql.org
Subject: Re: problems with pg_dump and pg_restore
Date: Thu, 07 Oct 2004 11:17:55 -0400
Message-ID: <28920.1097162275@sss.pgh.pa.us> (raw)
In-Reply-To: <p06110400bd8a69770b18@[192.168.123.110]>
References: <B7F9814D6850C949947CF8DEA13477810207AAB5@s5-ccr-r2.ccrs.nrcan.gc.ca>
<ck1tfn$4d2$2@floppy.pyrenet.fr>
<1790.1097106631@sss.pgh.pa.us>
<p06110400bd8a69770b18@[192.168.123.110]>
admin@usachurch.com writes:
> pg_restore -U admin -c /home/postgres/staging-dump
> Now, although tons of data is now streaming to my monitor, when it is
> done, none of the new data is in the backup's staging db.
The default behavior of pg_restore is to emit SQL commands onto stdout,
which of course is not going to do a lot for your backup DB. What you
probably want is to include a "-d database" switch to tell it to connect
to a database and send the commands there.
> So, I tried doing this variation:
> pg_restore -U admin -C -d staging /home/postgres/staging-dump
> pg_restore: [archiver (db)] could not execute query: ERROR: database
> "staging" already exists
-C tells it to create (and then connect to) the target DB, rather than
connect to an existing DB and restore into that. So generally you want
to say "-d template1" (or some other existing DB) when you use -C.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, admin@usachurch.com
Subject: Re: problems with pg_dump and pg_restore
In-Reply-To: <28920.1097162275@sss.pgh.pa.us>
References: <B7F9814D6850C949947CF8DEA13477810207AAB5@s5-ccr-r2.ccrs.nrcan.gc.ca> <ck1tfn$4d2$2@floppy.pyrenet.fr> <1790.1097106631@sss.pgh.pa.us> <p06110400bd8a69770b18@[192.168.123.110]> <28920.1097162275@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox