Re: Creating db from sql script file

From: Danny Aldham <danny(at)lennon(dot)postino(dot)com>
To: JWinn(at)HuffTech(dot)com (John Winn)
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Creating db from sql script file
Date: 2002-01-04 17:56:42
Message-ID: 200201041756.g04HugG07184@lennon.postino.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

>
> I have worked with MSSql for awhile and one of the most convienent features of the Enterprise Manager is the "export sql to file"
> function. I am new to postgres and wondering if postgres supports this. The main reason is I use a dev. box and a live box. If I make the changes on the dev box, can I export the sql and transfer it to the live box? Not to mention, when the database is created it would be nice to export the sql to have a hard copy.
>
> Is there an export/import sql feature? I have not been able to find it.
>

Yep. To export a database use the pg_dump command, like:
/usr/local/pgsql/bin/pg_dump DB.Name > /tmp/DB.Name.sql
And then to import it, create your database and then use psql like:
/usr/local/pgsql/bin/psql DB.Name < /tmp/DB.Name.sql

-- Danny Aldham Providing Certified Internetworking Solutions to Business
www.postino.com E-Mail, Web Servers, Web Databases, SQL PHP & Perl

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jason Earl 2002-01-04 18:10:17 Re: Creating db from sql script file
Previous Message John Winn 2002-01-04 17:23:38 Creating db from sql script file