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 /
- All required PostgreSQL connection parameters have been set
These assumptions are not strictly required, but they make the whole procedure simpler and more readable, because we can avoid adding lots of command line options to specify the data directory or any connection detail every time we connect to the database.
The initial procedure is step 1 onwards. If you are running subsequent backups, start from step 3.