Обсуждение: how to create script of database in postgres..sql(winxp)

Поиск
Список
Период
Сортировка

how to create script of database in postgres..sql(winxp)

От
"deepak pal"
Дата:
hi
  i am trying to make script file for my database by using pg_dump in windows as u say i open psql to postgres  then a prompt postgres# open then i write \i pg_dump it shows error.what should i do...plz hepl........
 

Re: how to create script of database in postgres..sql(winxp)

От
"A. Kretschmer"
Дата:
am  03.04.2006, um 17:20:56 +0530 mailte deepak pal folgendes:
> hi
>   i am trying to make script file for my database by using pg_dump in

If you want to write your own scriptfiles, you should better use a
editor for this.


> windows as u say i open psql to postgres  then a prompt postgres# open then
> i write \i pg_dump it shows error.what should i do...plz hepl........

No. You should type \i <your_script>, and replace <your_script> with the
filename (and maybe the path to this file).


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

Fwd: how to create script of database in postgres..sql(winxp)

От
"Tomi NA"
Дата:


---------- Forwarded message ----------
From: deepak pal <deepak.05pal@gmail.com>
Date: Apr 3, 2006 2:05 PM
Subject: Re: [GENERAL] how to create script of database in postgres..sql(winxp)
To: Tomi NA <hefest@gmail.com>

it do not recognize that \i and pg_dump i use \i pg_dump mydbname>newdb command



From the examples in man pg_dump:

       To dump a database:

       $ pg_dump mydb > db.out


       To reload this database:

       $ psql -d database -f db.out


       To dump a database called mydb to a tar file:

       $ pg_dump -Ft mydb > db.tar


       To reload this dump into an existing database called newdb:

       $ pg_restore -d newdb db.tar


Have you tried to dump the database this way? Does it work?

t.n.a.

Re: how to create script of database in postgres..sql(winxp)

От
Robert Treat
Дата:
On Monday 03 April 2006 07:50, deepak pal wrote:
> hi
>   i am trying to make script file for my database by using pg_dump in
> windows as u say i open psql to postgres  then a prompt postgres# open then
> i write \i pg_dump it shows error.what should i do...plz hepl........

you need to use the pg_dump program, which is a seperate program from psql.
IIRC it is in your start menu, but if not you will need to access it from a
command line window.
--
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

Re: how to create script of database in postgres..sql(winxp)

От
Michael Trausch
Дата:
deepak pal wrote:
> hi
>   i am trying to make script file for my database by using pg_dump in
> windows as u say i open psql to postgres  then a prompt postgres# open
> then i write \i pg_dump it shows error.what should i do...plz hepl........
>

\i in psql is for including a file to be read and parsed by the database
server.  Surely, this is not what you are after.

Since you have not specified the version of PostgreSQL that you're
using, I'm going to take the liberty of assuming that you're using 8.1.

http://www.postgresql.org/docs/8.1/interactive/backup.html

That portion of the manual should address your needs with regards to
using pg_dump and other utilities.  It is the Backup/Restore chapter of
the manual.

    - Mike