Partial database exports (Simple)
Backups are not limited to the whole running instance. Each database can be dumped individually with the pg_dump
utility.
Getting ready
Please refer to the Getting a basic export (Simple) recipe on preparing a sample
database.
How to do it...
This time, we will need to execute the following commands on the command line:
- First, type the following command to obtain global objects such as
users
,groups
, andpasswords
:$> pg_dumpall -g -f globals.sql
- Next, this command will create a
sample
database:$> pg_dump -f sample_backup.sql sample
How it works...
This took a bit more effort, but not much. Because the pg_dump
utility can only back up one database at a time, we don't get global objects such as users
and groups
. Thus ...
Get Instant PostgreSQL Backup and Restore How-to now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.