Last active
August 29, 2015 14:00
-
-
Save amolkhanorkar/11250581 to your computer and use it in GitHub Desktop.
Postgresql Database Backup & Restore
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
First take dump using this method | |
Dump schema of database: | |
pg_dump -Fp -s -v -f abc-schema.sql -U postgres dbname | |
Dump contents of database: | |
pg_dump -Fc -v -f abc-full.dump -U postgres dbname | |
Then restore using this methodology | |
psql -f abc-schema.sql dbname | |
pg_restore -a -d dbname -Fc abc-full.dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment