PostgreSQL comes with built-in utilities for creating and restoring backups
Note: All commands can take the login url in the format postgres://db_user:db_pass@db_host:db_port/db_name?sslmode=disable
Backup
|
|
Possible options:
-W
: prompt for password-F
: Formatp
: plain sqlc
: custom-format archived
: directory-format archivet
: tar-format archive
|
|
Take a compressed backup of PostgreSQL database
|
|
You can also pass in a connection strong
|
|
DB restore
To restore
|
|
The -C
flag is for creating a database before restoring data into it.
|
|
Restoring from a compressed backup
|
|
Backing up a specific table
|
|
Restoring a table from SQL file
|
|
Backing up all the databases at once
|
|
Restoring all the databases from the backup file
|
|