This is a discussion on Postgres backup within the Databases servers forums, part of the Mastering Servers category; Hai, How do I make a backup under postgres database server? Under mysql I can use mysqldump.. what about pgsql ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
Hai,
How do I make a backup under postgres database server? Under mysql I can use mysqldump.. what about pgsql ??? any idea what command i need to use. Also specify script if possible. TIA
__________________
There's no place like 127.0.0.1 |
| Sponsored Links | ||
|
|
|
||||
|
Here is my postgres (pgsql) backup script:
Code:
#!/bin/sh
# Bak dump dir - Change me
BACKUP="/backup"
# get list of dbs
PGDBS=$(psql -h localhost -U postgres -q -c "\l" | sed -n 4,/\eof/p | grep -v rows\) | awk {'print $1'})
for d in $PGDBS; do
NOW=`date '+%T %x'`
vacuumdb -z -h localhost -U postgres $d
pg_dump $d -h localhost | gzip > "$BACKUP/postgresql-$d-$NOW.gz"
done
Code:
03 05 * * * /path/to/pgsql.backup.sh > /dev/null 2>&1
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
|
||||
|
Also see Howto Backup PostgreSQL Databases for more info about commands.
|
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Postgres idle connections | kasimani | Databases servers | 1 | 05-14-2007 06:58 PM |
| Postgres vacuumdb usage | kasimani | Databases servers | 2 | 03-06-2007 08:30 AM |