Re: problems with pg_dump and pg_restore

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: admin(at)usachurch(dot)com
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: problems with pg_dump and pg_restore
Date: 2004-10-07 15:17:55
Message-ID: 28920.1097162275@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

admin(at)usachurch(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message JEDIDIAH 2004-10-07 15:29:31 Re: Multiple WALs for PITR ?
Previous Message Jay A. Kreibich 2004-10-07 14:59:36 Re: Multiple WALs for PITR ?