Re: Schema backup - Mailing list pgsql-general

From Tom Lane
Subject Re: Schema backup
Date
Msg-id 27255.1064609370@sss.pgh.pa.us
Whole thread Raw
In response to Schema backup  ("Claudio Lapidus" <clapidus@hotmail.com>)
List pgsql-general
"Claudio Lapidus" <clapidus@hotmail.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

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Schema backup
Next
From: Peter Eisentraut
Date:
Subject: Re: Escape sequence for unicode characters