pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
To: dima <_pppp@mail.ru>
To: Colin Stearman <cstearman@infofind.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Database backup and restore
Date: Fri, 22 Nov 2002 14:40:26 -0500
Message-ID: <2D92FEBFD3BE1346A6C397223A8DD3FC0920A8@THOR.goeci.com> (raw)

In bash, I use:

========== script fragment ==========
~!/bin/bash
$BackupDir=<whereever>
$LogFile=<whichever>
for db_name in $(/usr/local/pgsql/bin/psql -U postgres -d template1 -n -t -c
"select datname from pg_database where datistemplate='f';");
	do
		/usr/local/pgsql/bin/pg_dump -U postgres -Fc -Z1 -b
"$db_name" -f "$BackupDir/$db_name.pgdump" 2>> $LogFile.err && \
			echo "$(date +%c): Successfully dumped database
$db_name" >> $LogFile
	done
========== script fragment ==========

Cheers,
	Murthy


-----Original Message-----
From: dima [mailto:_pppp@mail.ru]
Sent: Friday, November 22, 2002 11:07
To: Colin Stearman
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Database backup and restore


> Am I missing something?   There seems to be no way to dump all databases 
> and then restore them (as you'd have to do on a version change) if the 
> databases contain blobs.
>  
> pg_dump supports dumping of blobs with the -b -Ft switch, but using 
> pg_dumpall with those switches doesn't seem to work.  And in any case, 
> pg_restore seems to be missing its equivalent pg_restoreall.  Other than 
> (painfully) manually pg_dumping and pg_restoring each database, how else 
> could it be done?
>  
> I would search the mailing lists but the site's search engine is down.
i wrote a script in perl which dumps all the DBs but template*
i can mail it to you if you wish


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



view thread (9+ messages)  latest in thread

Message-ID: <2D92FEBFD3BE1346A6C397223A8DD3FC0920A8@THOR.goeci.com>
Permalink:  ../2D92FEBFD3BE1346A6C397223A8DD3FC0920A8@THOR.goeci.com/
Also on:    postgresql.org/message-id/2D92FEBFD3BE1346A6C397223A8DD3FC0920A8@THOR.goeci.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: murthy.kambhampaty@goeci.com, _pppp@mail.ru, cstearman@infofind.com
  Subject: Re: Database backup and restore
  In-Reply-To: <2D92FEBFD3BE1346A6C397223A8DD3FC0920A8@THOR.goeci.com>
  References: <2D92FEBFD3BE1346A6C397223A8DD3FC0920A8@THOR.goeci.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox