Re: Schema backup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Claudio Lapidus" <clapidus(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Schema backup
Date: 2003-09-26 20:49:30
Message-ID: 27255.1064609370@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Claudio Lapidus" <clapidus(at)hotmail(dot)com> writes:
> I need to transfer a database installation from one host to another. I need
> to dump all users, databases, schemas, stored procedures, triggers, etc. but
> no actual data at all. What I try to achieve is a fresh clone ready to run.
> I tried pg_dump -s and pg_dumpall, but somewhere I'm missing something, so:
> what is the procedure to dump all database structure alone, and what is the
> proper reload procedure?

The proper procedure IMHO would be
pg_dumpall -s >dumpfile
psql template1 <dumpfile

There is a small problem with this in 7.3.* (but not before or after):
due to an oversight, that version of pgdump_all doesn't support the -s
switch. So if you are using 7.3 you have to do something like

pg_dumpall -g >dumpfile
for each database:
pg_dump -C -s database >>dumpfile

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-09-26 20:50:27 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)
Previous Message Peter Eisentraut 2003-09-26 20:47:38 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)