Skip to content

Instantly share code, notes, and snippets.

@amolkhanorkar
Last active August 29, 2015 14:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amolkhanorkar/11250581 to your computer and use it in GitHub Desktop.
Save amolkhanorkar/11250581 to your computer and use it in GitHub Desktop.
Postgresql Database Backup & Restore
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