Database Reference
In-Depth Information
How it works...
As you can see, backing up your database is easy in PostgreSQL. Unfortunately,
backupsaremeaninglessifnotperformedonaregularschedule.Ifthedatabaseis
lostorcorrupted,anyworkdonesincethelastbackupisalsolost.Itisencouraged
that backups be done at intervals that minimize the amount of work lost. The
ideal interval will depend on the frequency of changes done to the database. The
pg_dump
utility can be scheduled to run at regular intervals by adding a job to
theoperatingsystem'staskscheduler,withinstructionsavailableinthePostgreSQL
The
pg_dump
utility is not adequate for all situations. If you have a database un-
dergoing constant changes or one that is larger than a few tens of gigabytes, you
willneedabackupmechanismfarmorerobustthanthatdiscussedinthisrecipe.In-
formationregardingtheserobustmechanismscanbefoundinthePostgreSQLdoc-
umentation at
http://www.postgresql.org/docs/current/static/backup.html
.
The following are several third-party backup tools available for establishing robust
and advanced backup schemes:
• Barman,which is available at
http://www.pgbarman.org
• pg-rman,which is available at
http://code.google.com/p/pg-rman