Skip to content

Instantly share code, notes, and snippets.

@ffbit
Created July 5, 2012 11:38
Show Gist options
  • Save ffbit/3053222 to your computer and use it in GitHub Desktop.
Save ffbit/3053222 to your computer and use it in GitHub Desktop.
PostgreSQL restore
#!/bin/bash
DB="dbname"
HOST="host"
UNAME="uname"
dropdb --host $HOST --port=5432 --username $UNAME $DB
createdb --host $HOST --port 5432 --username $UNAME --owner $UNAME $DB
gunzip -c $DB.backup.gz | psql --host $HOST --port 5432 --username $UNAME -d $DB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment