Unix Technical Forum

Problem in offline backup & restore

This is a discussion on Problem in offline backup & restore within the pgsql Novice forums, part of the PostgreSQL category; --> Hi I am trying to implement backup and restore feature. For backup I am issuing the command from windows ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 11:09 PM
Sree Narayana
 
Posts: n/a
Default Problem in offline backup & restore

Hi

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.

Please help me.

Thanks

Sreeman

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 11:09 PM
Richard Broersma Jr
 
Posts: n/a
Default Re: Problem in offline backup & restore

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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 11:09 PM
John Purser
 
Posts: n/a
Default Re: Problem in offline backup & restore

On Tue, 2006-09-05 at 19:33 +0530, Sree Narayana wrote:
> Hi
>
> 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.
>
> Please help me.
>
> Thanks
>
> Sreeman


Morning Sreeman,

The backup and restore commands are commands TO a running instance of
postgresql. Without the server running they can't do anything. If
you're looking for a backup solution that doesn't require a running
instance of postgresql then look at doing a file system backup. For
this method to work postgresql CAN'T be running so you have to shut it
down before backing up and before restoring.

I do believe most people use the pgdump or pgdumpall method rather than
the file system method.

John Purser


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:46 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com