Created
March 25, 2013 16:29
-
-
Save tinderfields/5238440 to your computer and use it in GitHub Desktop.
Dump and restore a Postgres database
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 -U db_user -h localhost -xcO db_name | bzip2 - - > db/db_name.sql.bz2 | |
# Restore | |
# Delete database then recreate then | |
bunzip2 -f db/db_name.sql.bz2 | |
psql -U db_user -h localhost db_name < db/db_name.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment