Last active
August 29, 2015 14:25
-
-
Save MyExperiments/b8f6f9a4c4e80ca11613 to your computer and use it in GitHub Desktop.
Postgres - Backup and Restore Database
This file contains hidden or 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
Create dump | |
------------ | |
pg_dump database_name > pgdumpfile.sql | |
Create dump and compress | |
------------------------ | |
pg_dump database_name | gzip -c > pgdumpfile.sql.gz |
This file contains hidden or 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
Uncompress dump | |
---------------------- | |
gunzip pgdumpfile.sql.gz | |
Restore dump | |
---------------------- | |
psql -d database_name -f pgdumpfile.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment