Re: Restiring pg_dump text file

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
Cc: donghe(at)caltech(dot)edu, Mike angelo <angelocmp(at)yahoo(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Restiring pg_dump text file
Date: 2009-07-01 05:58:08
Message-ID: dcc563d10906302258w2b3c56c7ic301ce2ab9fae90c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Jun 30, 2009 at 9:36 PM, Scott Mead<scott(dot)lists(at)enterprisedb(dot)com> wrote:
>
>
>
> On Tue, Jun 30, 2009 at 11:26 PM, <donghe(at)caltech(dot)edu> wrote:
>>
>> > I've backed up my DB via 'pg_dump dbname' using no options. In order to
>> > restore it via psql, do I first need to drop the db instance and
>> > recreate
>> > it?
>> >
>> > Thanks in advance for your help.
>> >
>> > -Mike
>> >
>> >
>> >
>> yes, you have to drop the original db, then use psql -f to restore it.
>
>   You don't have to drop it, you can create another db by any other name and
> re-run the sql file there.  The only time you have to worry is if you use
> the -C (--create) option to pg_dump.  This would actually issue a 'create
> database' command in the sql dump.  But for you, you can restore to another
> database if you would like.  That being said, if this is production, I would
> be careful to not 'accidentally' run the sql file against the wrong
> database, so for your own sanity, you may want to just drop the db.  But
> there's no *requirement* that you do so.

If you've got the space, an easy trick is to rename the old db to
something else, create a new one in its place and restore to that.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mark Steben 2009-07-01 20:11:25 Hot standby
Previous Message raghu ram 2009-07-01 03:44:46 Re: how much memory (work_mem) is a query using?