Re: backup postgres database

From: Frank Finner <postgresql(at)finner(dot)de>
To: arun kv <arun(at)library(dot)iisc(dot)ernet(dot)in>
Cc: PGSQL <pgsql-php(at)postgresql(dot)org>
Subject: Re: backup postgres database
Date: 2002-03-13 18:51:07
Message-ID: XFMail.020313195107.postgresql@finner.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

Hi,

pg_dump and psql are your friends.

Dump the database with pg_dump, take the file and insert it into psql
on the other machine. Details are covered in the manpages of these
programs.

Crude (without options): pg_dump your_db > your_db.dump
psql < your_db.dump

In the manpages you also find the options to dump with all create
statements (e.g. CREATE DATABASE on the new machine) you might need.

pg_dump is also THE solution to make backups. If you simply take the
database files (especially, if the engine is running), you probably
cannot use them either for backup or for transferring due to caching
and other things. With pg_dump you even can transfer your database to
another database engine (from PostgreSQL to Oracle for example), if you
dump it with the option of complete insert statements.

mfg frank finner

On 13-Mar-02 arun kv sat down, thought for a long time and then wrote:
> hello sir,
> i have a postgresql database in one system and want to
> transfer
> the same to another system. i am not finding a way to transfer this
> database from one system to another.if i transfer the file in
> /var/lib/pgsql/libdatabase them it gives error.how shall i transfer
> database.
> another thing. how to take up backups of the database on the
> system.
> pls help me as i am new to postgresql
> thanking you
> Arun
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
Frank Finner

And now there is no turning back at all.
(M. Moorcock, "Elric Of Melnibone")"

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Martín Marqués 2002-03-13 22:00:59 Re: backup postgres database
Previous Message Marcelo Pereira 2002-03-13 18:33:37 Re: backup postgres database