Use the following steps to back up a database:
- Start backing up the chapter10 database by executing the following command:
> pg_dump -f chapter10.backup -F custom chapter10
We use the -f flag to specify that the backup should be placed in the chapter10.backup file. We also use the -F flag to set the format of the backup output as custom - the most flexible and compressed of pg_dump's output formats by default.
- Inspect the backup file by outputting the contents onto a SQL file by executing the following command:
> pg_restore -f chapter10.sql chapter10.backup
After creating a backup, it is good practice to make sure that the backup is valid. We do so with the pg_restore PostgreSQL tool. The -f flag instructs pg_restore ...