Re: Copy Database Structure

From: "Christopher A(dot) Goodfellow" <cgoodfellow(at)tealuxe(dot)com>
To: "'Jeff Self'" <jself(at)nngov(dot)com>
Cc: "'Pgsql-Novice (E-mail)'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Copy Database Structure
Date: 2002-03-01 17:25:46
Message-ID: 000f01c1c146$20e2f1e0$2284de3f@tealuxe.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks, that worked great!!!!!!

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

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Jeff Self
Sent: Friday, March 01, 2002 11:54 AM
To: cgoodfellow(at)tealuxe(dot)com
Cc: Pgsql-Novice (E-mail)
Subject: Re: [NOVICE] Copy Database Structure

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(at)postgresql(dot)org
--
Jeff Self
Information Technology Analyst
Department of Personnel
City of Newport News
2400 Washington Ave.
Newport News, VA 23607
757-926-6930

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-03-01 17:31:54 Re: timestamp value
Previous Message Jeff Self 2002-03-01 16:53:34 Re: Copy Database Structure