Re: createdb Question

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: <operationsengineer1(at)yahoo(dot)com>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: createdb Question
Date: 2005-11-16 01:33:17
Message-ID: E05B4B3F-562E-4E84-A721-A9D2BC007C93@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Nov 16, 2005, at 8:45 , <operationsengineer1(at)yahoo(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Emiliano Amilcarelli 2005-11-16 14:09:09 plpython integer types
Previous Message me 2005-11-16 00:59:52 8.1: autovacuum not doing its job?