dbTalk Databases Forums  

Re: Backups

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Re: Backups in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Neacal
 
Posts: n/a

Default Re: Backups - 09-21-2004 , 08:37 AM






In article <414F2471.9050104 (AT) insys-corp (DOT) com.mx>, Eduardo Vázquez
Rodríguez <evazquez (AT) insys-corp (DOT) com.mx> wrote:

Quote:
Hello everybody out there using Postgres!!!

I have a couple of questions

1. If I am not wrong (using default values) Postgresql allocate all the
database tables under /usr/local/data. is that correct?

2. How do I make a backup of a database in a different partition?, for
instance /home/postgres

Thanks in advanced

Hola Eduardo

I'm using the MacOSX package, which suggests your q1 should be revised
to /usr/local/pgsql/data.

I'm still a novice to postgresql, but as I have just researched the
backup issue in the O'Reilly book, I'll have a go at answering q2.

pg_dump will do this for you; you don't have to be in the pgsql
directory, pg_dump can even be run from another server.

My best guess is to run the command from the other partition. So it
would be something like:

# pathto/usr/local/bin/pg_dump --file=youdata.sql --format=p yourdata

you have a choice of formats: c=gzip, t=tar, p=plain text

If you wanted to backup the entire filesystem, stop the server and make
a copy, something like this (compressed):

# cd /usr/local/pgsql
# /usr/local/bin/pg_ctl stop
# tar czf pgsql.bak.tar.gz data/

then you can

# mv pgsql.bak.tar.gz /path/to/where/you/want

or cp to be safe!

Well, that's my solution. I did try out various options myself on a
testdb, with no problems. So I hope I'm not misleading you.

Buena suerte

Neacal


Reply With Quote
  #2  
Old   
Frank Bax
 
Posts: n/a

Default Re: Backups - 09-22-2004 , 11:09 AM






At 02:41 PM 9/20/04, Eduardo Vázquez Rodríguez wrote:
Quote:
How do I make a backup of a database in a different partition?, for
instance /home/postgres

This works for me (replace [database] with name of your database):

pg_dump -o -c [database] | gzip > /home/postgres/[database].`date
+\%Y\%m\%d`.gz

Frank


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.