Last active
September 6, 2017 19:41
-
-
Save gidj/b886df2508024eb9d95509c765b09400 to your computer and use it in GitHub Desktop.
Restoring a gzipped SQL dump
This file contains hidden or 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 get the file: | |
scp [email protected]:~/rds_backups/backup-2017-08-27.sql.gz ./ | |
# Drop and create the template database: | |
sudo -u postgres dropdb aya_prod && sudo -u postgres createdb aya_prod | |
# Copy it to the virtual disk, then create a new database with it: | |
gunzip < database.sql.gz | sudo -u aya psql aya_prod | |
# As long as that goes well, drop and create the production database using the template database | |
sudo -u postgres dropdb aya | |
sudo -u postgres psql | |
> CREATE DATABASE aya WITH TEMPLATE aya_prod OWNER aya ENCODING='UTF8'; | |
# And you're finished! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment