Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Book Image

PostgreSQL 9 Administration Cookbook - Second Edition

Overview of this book

Table of Contents (19 chapters)
PostgreSQL 9 Administration Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Standalone hot physical database backup


Hot physical backup is an important capability for databases.

Physical backup allows us to get a completely consistent view of the changes to all databases at once. Physical backup also allows us to back up even while DDL changes are being executed on the database. Apart from resource constraints, there is no additional overhead or locking with this approach.

Physical backup procedures are slightly more complex than logical backup procedures. So, let's start with a simple procedure to produce a standalone backup.

How to do it…

The following steps assume that a number of environment variables have been set, which are as follows:

  • $PGDATA is the path to the PostgreSQL data directory, ending with /

  • $BACKUPNAME is the filename of a backup file, that is, mybackup.tar

  • All required PostgreSQL connection parameters have been set

Note

The initial procedure is step 1 onwards. If you are running subsequent backups, start from step 6.

The steps are as follows:

  1. Create...