Last active
May 17, 2017 23:03
-
-
Save daspecster/9ed8f235186c731bcc2f to your computer and use it in GitHub Desktop.
Postgres Backup
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 and restore databases | |
# Backup | |
pg_dump -h <orig db> -U <user> -Fc > data.backup | |
psql in to db... | |
$ drop schema public cascade; | |
$ \connect postgres | |
$ drop database <dbname>; | |
# Restore | |
pg_restore --verbose --exit-on-error -Fc -n public -d <Database> -U <user> -h <rds instance> <db file> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment