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

Started by deepak palabout 20 years ago5 messagesgeneral
Jump to latest
#1deepak pal
deepak.05pal@gmail.com

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........

#2Michael Trausch
michael.trausch@comcast.nope.net
In reply to: deepak pal (#1)
Re: how to create script of database in postgres..sql(winxp)

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

#3A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: deepak pal (#1)
Re: how to create script of database in postgres..sql(winxp)

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 ===

#4Tomi NA
hefest@gmail.com
In reply to: deepak pal (#1)
Fwd: how to create script of database in postgres..sql(winxp)

---------- 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.

#5Robert Treat
xzilla@users.sourceforge.net
In reply to: deepak pal (#1)
Re: how to create script of database in postgres..sql(winxp)

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