Need Help in creating script
Need Help in creating script
От:
"Prashant Sinha" <prashant@envivio.com>
Дата:
Hi,
I am a new postgre user. I had used sql commands to create database and tables. Is it possible to create a script or installable version on existing database which I could run on any machine and it would crearte the database with all the tables and everything. Can anyone please help me with this?
Thanks in advance,
-Prashant.
Re: Need Help in creating script
От:
"Oliver Elphick" <olly@lfix.co.uk>
Дата:
"Prashant Sinha" wrote:
>I am a new postgre user. I had used sql commands to create database and tab=
>les. Is it possible to create a script or installable version on existing d=
>atabase which I could run on any machine and it would crearte the database =
>with all the tables and everything. Can anyone please help me with this?
>Thanks in advance,
A simple example:
Put the database commands in a text file (precede comments with --):
CREATE DATABASE junk;
\connect junk
-- Table "a" is adgaga axdfaxdfga hgfadsh
CREATE TABLE a (f1 INT PRIMARY KEY,
f2 TEXT);
...and so on...
Then run the script:
$ psql Re: Need Help in creating script
От:
Alexander Dederer <dederer@spb.cityline.ru>
Дата:
Prashant Sinha wrote: > This is a multi-part message in MIME format. > > ------=_NextPart_000_0021_01C0DE12.BB861C80 > Content-Type: text/plain; charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Hi, > I am a new postgre user. I had used sql commands to create database and > tab= les. Is it possible to create a script or installable version on > existing d= atabase which I could run on any machine and it would crearte > the database = with all the tables and everything. Can anyone please help > me with this? Thanks in advance, Look programm: pg_dump pg_dumpall psql
Re: Need Help in creating script
От:
manuel@des01.sanyres.es
Дата:
In article <9dutbv$2hdu$2@news.tht.net>, Alexander Dederer wrote: > Prashant Sinha wrote: > >> This is a multi-part message in MIME format. >> >> ------=_NextPart_000_0021_01C0DE12.BB861C80 >> Content-Type: text/plain; charset="iso-8859-1" >> Content-Transfer-Encoding: quoted-printable >> >> Hi, >> I am a new postgre user. I had used sql commands to create database and >> tab= les. Is it possible to create a script or installable version on >> existing d= atabase which I could run on any machine and it would crearte >> the database = with all the tables and everything. Can anyone please help >> me with this? Thanks in advance, > > Look programm: > pg_dump > pg_dumpall > psql > > Use pg_dump. pg_dump > createdb cat | psql -- Manuel Cano Muñoz ------------------------------ SANYRES, S.A. Director Dpto. Sistemas manuel@sanyres.com manuel@sanyres.es