pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Dump & Load a database???
3+ messages / 3 participants
[nested] [flat]

* Dump & Load a database???
@ 2007-08-21 14:50 smiley2211 <smiley2211@yahoo.com>
  2007-08-21 14:57 ` Re: Dump & Load a database??? Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 1 reply; 3+ messages in thread

From: smiley2211 @ 2007-08-21 14:50 UTC (permalink / raw)
  To: pgsql-admin


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-database----tf4305692.html#a12256258
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Dump & Load a database???
  2007-08-21 14:50 Dump & Load a database??? smiley2211 <smiley2211@yahoo.com>
@ 2007-08-21 14:57 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
  2007-08-21 15:34   ` Re: Dump & Load a database??? Scott Marlowe <scott.marlowe@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Kevin Grittner @ 2007-08-21 14:57 UTC (permalink / raw)
  To: pgsql-admin; smiley2211 <smiley2211@yahoo.com>

>>> 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
 





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Dump & Load a database???
  2007-08-21 14:50 Dump & Load a database??? smiley2211 <smiley2211@yahoo.com>
  2007-08-21 14:57 ` Re: Dump & Load a database??? Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2007-08-21 15:34   ` Scott Marlowe <scott.marlowe@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Scott Marlowe @ 2007-08-21 15:34 UTC (permalink / raw)
  To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: pgsql-admin@postgresql.org, smiley2211 <smiley2211@yahoo.com>

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.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-08-21 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 14:50 Dump & Load a database??? smiley2211 <smiley2211@yahoo.com>
2007-08-21 14:57 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2007-08-21 15:34   ` Scott Marlowe <scott.marlowe@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox