Re: Restiring pg_dump text file - Mailing list pgsql-admin

From Scott Mead
Subject Re: Restiring pg_dump text file
Date
Msg-id d3ab2ec80906302036w49efa366u1ccf3fd9e881fa1c@mail.gmail.com
Whole thread Raw
In response to Re: Restiring pg_dump text file  (donghe@caltech.edu)
Responses Re: Restiring pg_dump text file  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-admin



On Tue, Jun 30, 2009 at 11:26 PM, <donghe@caltech.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.

--Scott 



--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

pgsql-admin by date:

Previous
From: donghe@caltech.edu
Date:
Subject: Re: Restiring pg_dump text file
Next
From: raghu ram
Date:
Subject: Re: how much memory (work_mem) is a query using?