Re: Copy Database Structure - Mailing list pgsql-novice

From Jeff Self
Subject Re: Copy Database Structure
Date
Msg-id 1015001614.5290.24.camel@personnel_test
Whole thread Raw
In response to Copy Database Structure  ("Christopher A. Goodfellow" <cgoodfellow@tealuxe.com>)
Responses Re: Copy Database Structure
List pgsql-novice
Try pg_dump -s dbname > outputfile
This gives you the schema of the database but without the data.

Then to reload it:
psql -e dbname < outputfile

Make sure you create the database first and have the owner set properly.
You may need to go into the outputfile and change the owner for the new
database.

On Fri, 2002-03-01 at 11:19, Christopher A. Goodfellow wrote:
> I have an existing database that I want to copy all the tables,
> relationships, and keys to another database.
> Does anyone know how to duplicate a database?
> I don't need to copy the data but I could always delete all the records
> after the copy if needed.
>
> Chris Goodfellow
> Director of IT
> Tealuxe, Inc.
> 25 Kenwood Circle
> Franklin, MA 02038
> Voice:  (508) 520-7887 Ext:22
> Fax: (508) 528-8999
> HTTP://www.tealuxe.com
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Jeff Self
Information Technology Analyst
Department of Personnel
City of Newport News
2400 Washington Ave.
Newport News, VA 23607
757-926-6930


pgsql-novice by date:

Previous
From: "Christopher A. Goodfellow"
Date:
Subject: Copy Database Structure
Next
From: "Christopher A. Goodfellow"
Date:
Subject: Re: Copy Database Structure