Re: createdb Question - Mailing list pgsql-novice

From Michael Glaesemann
Subject Re: createdb Question
Date
Msg-id E05B4B3F-562E-4E84-A721-A9D2BC007C93@myrealbox.com
Whole thread Raw
In response to createdb Question  (<operationsengineer1@yahoo.com>)
Responses Re: createdb Question
List pgsql-novice
On Nov 16, 2005, at 8:45 , <operationsengineer1@yahoo.com> wrote:

> if i can create a db as a copy of an existing db, can
> someone point me to howto or give a quick, fictional
> example how to get this done?

existing db cluster with db foo:
pg_dump foo > foo-dump.sql

new db cluster:
createdb foo2
psql -d foo2 -f foo-dump.sql

If you have users and groups that you need to transfer as well,
you'll want to look at pg_dumpall with the -g flag. You may want to
edit the output of pg_dumpall by hand to only get the things you
want. And you'll load the pg_dumpall output into the new db cluster
(with psql) before loading foo-dump.sql.

Take a look at the pg_dump and pg_dumpall docs for more details.

Hope this helps.

Michael Glaesemann
grzm myrealbox com




pgsql-novice by date:

Previous
From:
Date:
Subject: 8.1: autovacuum not doing its job?
Next
From: William Yu
Date:
Subject: Re: Application using PostgreSQL as a back end (experienced programmers