Creating a database with pg_restore

From: "Keith Worthington" <keithw(at)narrowpathinc(dot)com>
To: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Creating a database with pg_restore
Date: 2004-12-29 18:33:05
Message-ID: 20041229183305.M80560@narrowpathinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi All,

I have a database dump that is created with the following command:
pg_dump IPADB -Ft -s -v -U postgres | gzip -9 > ${IPA_TMP_DIR}/IPADB.$(date +"%
Y%m%d.%H%M%S").tar.gz

I want to create a test database but I am having difficulty understanding how
to use pg_restore.

# pg_restore --create --dbname=IPA_TEST --schema-only --verbose -U postgres
TEST.tar
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database "IPA_TEST" failed: FATAL:
Database "IPA_TEST" does not exist in the system catalog.
pg_restore: *** aborted because of error

The documentation indicates that the dumpfile is meant to be used by psql and
that I have to create the database manually prior to the restore. So what is
the purpose of pg_restore and it's --create option?

Any hints appreciated.

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message george young 2004-12-29 18:58:58 Re: [PERFORM] INSERT question
Previous Message Robert Treat 2004-12-29 03:57:28 Re: [PERFORM] slony replication