Created
April 30, 2022 17:08
-
-
Save rgpower/5ddcff08c47aa762d1a66b19236db5db to your computer and use it in GitHub Desktop.
Postgres (PG) Backup and Restore: pg_dump and pg_restore usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup | |
pg_dump -v -Fd -U $USER -f $DUMP_DIR $DB | |
# restore, doing required drops beforehand to avoid most constraint errors | |
pg_restore --verbose --clean --no-acl --no-owner -Fd -U $USER -d $DB $DUMP_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment