pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: admin@usachurch.com
To: pgsql-admin@postgresql.org
Subject: problems with pg_dump and pg_restore
Date: Wed, 6 Oct 2004 20:52:17 -0700
Message-ID: <p06110400bd8a69770b18@[192.168.123.110]> (raw)
In-Reply-To: <1790.1097106631@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>

Hello list,

I am having problems getting pg_dump and pg_restore to work the way
they are supposed to work - or at least the way I imagine they should work!

I have a primary DB server, and a backup DB server.  The point is to 
use pg_dump
every 5 minutes to have the current postgeSQL db available on the 
backup DB box.
btw, these are both running version 7.4.2.

Here's the command I am issuing on the primary DB server:

pg_dump -U admin staging -Fc -b -f /home/postgres/staging-dump

And, it seems to work - creating a 20MB archive that has some readable text in
it near the top, and a bunch of random characters to the end.  According to the
docs, this file should be able to used in many different ways by the pg_restore
command.  So, on the backup DB server, I am trying to completely rebuild the
staging database to the exact state of the primary server with:

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.

So, I tried deleting "staging" on the backup server with:
dropdb -U admin staging

and then create it again:
createdb -U dba staging -O admin

And when I run the above pg_restore command, none of the data or schema is in
the newly created staging db.

So, I tried doing this variation:

pg_restore -U admin -C -d staging /home/postgres/staging-dump

but I get this error:
pg_restore: [archiver (db)] could not execute query: ERROR:  database 
"staging" already exists

and if i don't recreate the staging db with the createdb command, I 
get this error:
pg_restore: [archiver (db)] connection to database "staging" failed: 
FATAL:  database "staging" does not exist

I'm sure that I'm close to getting this to work - any advise?

Thanks,
Devin



view thread (3+ messages)  latest in thread

Message-ID: <p06110400bd8a69770b18@[192.168.123.110]>
Permalink:  ../p06110400bd8a69770b18@%5B192.168.123.110%5D/
Also on:    postgresql.org/message-id/p06110400bd8a69770b18@[192.168.123.110]

 · 

reply

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: admin@usachurch.com
  Subject: Re: problems with pg_dump and pg_restore
  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]>

* 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