Last active
August 29, 2015 14:22
-
-
Save joselo/3284596ac6d7367e918c to your computer and use it in GitHub Desktop.
Backup 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
# back the postgres database including the database name (create database... etc.) | |
pg_dump -C database > database.back | |
# restore the database | |
psql < database.back | |
# Rename database | |
ALTER DATABASE name RENAME TO new_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment