Re: Problem in offline backup & restore

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Sree Narayana <sreeman007(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Problem in offline backup & restore
Date: 2006-09-05 14:24:26
Message-ID: 20060905142426.41151.qmail@web31807.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> I am trying to implement backup and restore feature.
> For backup I am issuing the command from windows cmd prompt:
> C:\ [path to pg_dump.exe ]\pg_dump.exe -i -h localhost -p 5432 -U postgres
> -F c -b -v -f C:\MyBackups\db_backup.backup mydb
> For restore I am issuing the following command:
> C:\[path to pg_restore.exe ]\pg_restore.exe -i -h localhost -p 5432 -U
> postgres -d mydb -c -v C:\MyBackups\db_backup.backup
> The above 2 commands working perfect while database is online (running).
> However the problem is they are not working while database is offline
> (database shutdown)
> It is showing the following error message:
> pg_dump: [archiver (db)] connection to database "mydb" failed: could not
> connect
> to server: Connection refused (0x0000274D/10061)
> Is the server running on host "localhost" and accepting
> TCP/IP connections on port 5432?
> pg_dump: *** aborted because of error
> Is it possible to backup & restore the database offline? If so what is the
> problem in my command.

The error message you received is correct due to what you are trying to achieve. When you
shutdown the postmaster, there is no longer any PostgreSQL service to process any of your
commands.

The only way that I can think of to back-up the database while the postgresql service is down, is
to copy the entire postgresql data directory to another location. However, I highly doubt this is
what you really want. However if you know what you are doing it is possible but less safe than a
regular pg_dump'ed file.

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message John Purser 2006-09-05 14:38:52 Re: Problem in offline backup & restore
Previous Message Sree Narayana 2006-09-05 14:03:50 Problem in offline backup & restore