Skip to content

Instantly share code, notes, and snippets.

@tobyhede
Last active October 11, 2015 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobyhede/3890243 to your computer and use it in GitHub Desktop.
Save tobyhede/3890243 to your computer and use it in GitHub Desktop.
Dump and restore postgres to remote server
Pipe directly to remote server
pg_dump -C -U dbuser {DBNAME} | psql -h xxx.xxx.xxx.xx -U {DBUSER} >> restore.log
And with passwords as required
PGPASSWORD="{DBPASSWORD}" pg_dump -C -U dbuser {DBNAME} | PGPASSWORD="{DBPASSWORD}" psql -h xxx.xxx.xxx.xx -U {DBUSER} >> restore.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment