Unix Technical Forum

Dump & Load a database???

This is a discussion on Dump & Load a database??? within the pgsql Admins forums, part of the PostgreSQL category; --> Hello all, I am new to POSTGRESQL and I am trying to dump and load a database...using the steps ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:08 AM
smiley2211
 
Posts: n/a
Default Dump & Load a database???


Hello all,

I am new to POSTGRESQL and I am trying to dump and load a database...using
the steps below I get DUP errors when trying to LOAD the file into an
existing database...

Do I have to DROP \ recreate and load the target database (this is what I
currently do)? is there a way to just do an IN PLACE load like in other
RDBMS environments???

pg_dump proddb | gzip > proddb_082107.sql.gz

gunzip < proddb_082107.sql.gz | psql -d testdb -f -

Thanks,
Michelle.


--
View this message in context: http://www.nabble.com/Dump---Load-a-...html#a12256258
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 08:08 AM
Kevin Grittner
 
Posts: n/a
Default Re: Dump & Load a database???

>>> On Tue, Aug 21, 2007 at 9:50 AM, in message <12256258.post@talk.nabble.com>,
smiley2211 <smiley2211@yahoo.com> wrote:

> Do I have to DROP \ recreate and load the target database (this is what I
> currently do)? is there a way to just do an IN PLACE load like in other
> RDBMS environments???
>
> pg_dump proddb | gzip > proddb_082107.sql.gz
>
> gunzip < proddb_082107.sql.gz | psql -d testdb -f -


You might want to consider using one or both of these pg_dump options:

-c, --clean clean (drop) schema prior to create
-C, --create include commands to create database in dump




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 08:08 AM
Scott Marlowe
 
Posts: n/a
Default Re: Dump & Load a database???

On 8/21/07, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote:
> >>> On Tue, Aug 21, 2007 at 9:50 AM, in message <12256258.post@talk.nabble.com>,

> smiley2211 <smiley2211@yahoo.com> wrote:
>
> > Do I have to DROP \ recreate and load the target database (this is what I
> > currently do)? is there a way to just do an IN PLACE load like in other
> > RDBMS environments???
> >
> > pg_dump proddb | gzip > proddb_082107.sql.gz
> >
> > gunzip < proddb_082107.sql.gz | psql -d testdb -f -

>
> You might want to consider using one or both of these pg_dump options:
>
> -c, --clean clean (drop) schema prior to create
> -C, --create include commands to create database in dump


and note that you don't need a file in between steps.

pg_dump -c proddb | psql -d testdb

pg_dump --help and psql --help will give you a list of all the
switches you can throw at them.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com