Re: Problem with pg_restore into new database

From: "Mr(dot) John" <mr_johnmr(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with pg_restore into new database
Date: 2008-11-17 12:34:46
Message-ID: 931681.50411.qm@web45515.mail.sp1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Raymond
"pg_restore.exe" -h 192.168.1.1 -p 5432 -U postgres -d "postgres" -C "stru.tar" 2>>log_resto.txt
echo %errorlevel% >err_resto.txt

created and restored my database with the name saved in backup
Thanks a lot.

________________________________
From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Mr. John <mr_johnmr(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Sent: Monday, November 17, 2008 1:49:17 PM
Subject: Re: [GENERAL] Problem with pg_restore into new database

On 17/11/2008 11:26, Mr. John wrote:
> I read pg_restore documentation and what I understood is that using
> pg_restore.exe with -C will create the database named in backup archive
> or specified with -d

You have to connect to *some* database, as Postgres doesn't have the
concept of just connecting to the server without connecting to a database.

Postgres has a maintenance database called "postgres" which is empty,
and it's normal to use this for initial connections if you haven't
already got a specific database to work with. In psql, there's a \c
command with changes the database to which you're connected, and you'll
see this command used in the output from pg_dump to connect to the
database being dumped.

HTH,

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Isak Hansen 2008-11-17 12:54:52 Re: How to reduce impact of a query.
Previous Message Howard Cole 2008-11-17 12:15:01 How to reduce impact of a query.