-
Notifications
You must be signed in to change notification settings - Fork 37
Managing overview on amazon
adamhooper edited this page Jan 28, 2013
·
29 revisions
-
overview-manage ssh production databaseto log in to thedatabaseinstance sudo -u postgres psql overview
This works even while the database is being modified. The backed-up database will have the exact same state as the database had when the backup started.
If you're backing up a database from a remote Postgres server:
- Find the host, username, database and password of the database to back up.
-
pg_dump -Fc -f backup.psql --host HOST --user USERNAME DATABASEand enter the password.
But if you're logged into the database instance, it's easier (as long as you're in a directory with the right permissions):
sudo -u postgres pg_dump -Fc -f backup.psql
- Run
DROP SCHEMA public CASCADE; CREATE SCHEMA public;in a database shell. - Run
sudo -u postgres psql -f BACKUP-FILENAME DATABASE