Re: Backup & Restore - Mailing list pgsql-general

From Doug McNaught
Subject Re: Backup & Restore
Date
Msg-id m33czp1tz3.fsf@varsoon.denali.to
Whole thread Raw
In response to Backup & Restore  (Marcelo Pereira <gandalf@sum.desktop.com.br>)
List pgsql-general
Marcelo Pereira <gandalf@sum.desktop.com.br> writes:

> Hello All,
>
> Which is the simplest way to do a backup? My db is really small (about
> 4Mb), so I would like to make a backup to each day, save it in separated
> files, and restore it if necessary.
>
> So, which is the usual way to create the backup files? And how can I
> restore these backups?

The simplest way is to run pg_dump from a cron job and redirect the
output to a file.  You can name the file whatever you want.  The
output of pg_dump is SQL that will create and populate your database.

To restore, feed the dump file to 'psql'.

Note that if you're using large objects it gets a little more
complicated and you have to use 'pg_restore' rather than 'psql' for
restores.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: template Database
Next
From: Doug McNaught
Date:
Subject: Re: help with getting index scan