The right direction for backups?

Started by Nonameover 25 years ago5 messagesgeneral
Jump to latest
#1Noname
jeam@themail.com

Hi there,

I need to implement a routine backup procedure for PostgreSQL 6.5 under RedHat 6. I would like to save and restore a database complete with all its elements (tables, indexes, etc), all user privileges and group information.

Can someone please point me in the right direction?
Any help is much appreciated.

Thanks in advance,

J. Alvarez.
__________________________________________________________________
Make A Buck Or Two @ TheMail.com - Free Internet Email
Sign-up today at http://www.themail.com/ref.htm?ref=908313

#2James Hall
James.Hall@RadioShack.com
In reply to: Noname (#1)
RE: The right direction for backups?

I use the following Perl script: (it utilizes pg_dump instead of
pg_dumpall)- you may need to change the directory info based on your
install.

Hope it helps...
James Hall

======================================
--------start code---------------
#!/bin/sh

PSQL=/usr/bin/psql
DUMP=/usr/bin/pg_dump
PREFIX=`date +%j`
BACKUP_DIR=/data/pgsql/data

Databases=`$PSQL -tq -d template1 -c "select datname from pg_database"`
renice 20 $$

echo Backup started ...
for db in `echo $Databases`
do

echo "time: `date +%H%M%S` - Backup of $db in progress ..."
$DUMP -D $db > $BACKUP_DIR/$PREFIX.$db
echo "time: `date +%H%M%S` - Backup of $db finished ..."
done
echo Backup finished ...
-------end code-------------------

Show quoted text

-----Original Message-----
From: jeam@themail.com [mailto:jeam@themail.com]
Sent: Wednesday, July 12, 2000 4:05 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] The right direction for backups?

Hi there,

I need to implement a routine backup procedure for PostgreSQL
6.5 under RedHat 6. I would like to save and restore a
database complete with all its elements (tables, indexes,
etc), all user privileges and group information.

Can someone please point me in the right direction?
Any help is much appreciated.

Thanks in advance,

J. Alvarez.
__________________________________________________________________
Make A Buck Or Two @ TheMail.com - Free Internet Email
Sign-up today at http://www.themail.com/ref.htm?ref=908313

#3Travis Bauer
trbauer@indiana.edu
In reply to: James Hall (#2)
sql question

Let's say I have a table t1 with two fields, x and y. How do I write an
sql statement like:

select x if y>1 else 0 from t1;

For every record in which y is > 1, you get x back. Otherwise, you get 0
returned.

Thanks,
----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------

#4Ross J. Reedstrom
reedstrm@rice.edu
In reply to: Travis Bauer (#3)
Re: sql question

On Wed, Jul 12, 2000 at 05:33:09PM -0500, Travis Bauer wrote:

Let's say I have a table t1 with two fields, x and y. How do I write an
sql statement like:

select x if y>1 else 0 from t1;

SELECT CASE WHEN y>1 THEN x ELSE 0 END FROM t1;

From page 33 of Bruce's book, at:

http://www.postgresql.org/docs/aw_pgsql_book/node52.html

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005

#5Travis Bauer
trbauer@indiana.edu
In reply to: Ross J. Reedstrom (#4)
Re: sql question

Thanks,

Now that you mention it, I even remember reading it in the book!

----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------

On Wed, 12 Jul 2000, Ross J. Reedstrom wrote:

Show quoted text

SELECT CASE WHEN y>1 THEN x ELSE 0 END FROM t1;

From page 33 of Bruce's book, at: