Skip to content

Instantly share code, notes, and snippets.

@daspecster
Last active May 17, 2017 23:03
Show Gist options
  • Save daspecster/9ed8f235186c731bcc2f to your computer and use it in GitHub Desktop.
Save daspecster/9ed8f235186c731bcc2f to your computer and use it in GitHub Desktop.
Postgres Backup
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