Skip site navigation (1) Skip section navigation (2)

Re: Schemas, databases, and backups

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: Thomas Harold <tgh(at)tgharold(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Schemas, databases, and backups
Date: 2005-11-24 16:23:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On 11/24/05, Thomas Harold <tgh(at)tgharold(dot)com> wrote:
> According to my reading of the pgsql documentation, the two basic backup
> scripts are pg_dump and pg_dumpall.  pg_dump allows you to dump a single
> database to a file, while pg_dumpall dumps all of the databases to a
> single file.
> Currently, we use MSSQL's built-in backup facility.  That allows us,
> with a single command, to dump every database to separate files on a
> daily basis (and we keep 14-days online).  That makes recovering from a
> glitch in one of the databases very easy, and it's rather simple to go
> back to a particular day.
> Also, schemas are new to us, so I'm still thinking about how they will
> affect our processes and databases.

if you want to make querys that retrives info for more than one
database at the same time think in use schemas.

> (I'm betting that the ultimate answer is going to be to look for some
> 3rd party tool in pgFoundry.)
> So, now for the questions:
> 1) Is there a tool (or is this easily scripted in bash?) that would
> iterate through the databases in pgsql and dump them to individual
> files?  I'm guessing that we would query pg_databases and dump the
> database names to a file (how?) and then parse that to feed to pg_dump
> (I can figure this bit out myself).

psql -d template1 -U postgres -c "select datname from pg_databases
where datname not in ('template1', 'template0', 'postgres');" | while
read D;

or something like that in a shell script and the simply pg_dump $D...

> 2) What if I wanted to dump individual schemas?  Is this dangerous / not
> recommended?  (Probably not... if I can have relationships between
> tables in different schemas?)


Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to


pgsql-novice by date

Next:From: Martin FosterDate: 2005-11-24 17:25:13
Subject: Re: Schemas, databases, and backups
Previous:From: Peter GeorgeDate: 2005-11-24 15:53:32
Subject: 8.0.2 Install Problems on Win XP

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group