Skip to content

Instantly share code, notes, and snippets.

@jdeoliveira
Created November 15, 2012 19:28
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jdeoliveira/4080656 to your computer and use it in GitHub Desktop.
Save jdeoliveira/4080656 to your computer and use it in GitHub Desktop.
Dump/restore a postgres database in binary format for distribution
/Library/PostgreSQL/9.1/bin/pg_dump --host localhost --port 5432 --username <USERNAME> -b -c -E UTF-8 --no-owner --no-privileges --no-tablespaces --clean --schema public -F c -Z 9 -f <BACKUPFILENAME> <DATABASENAME>
/Library/PostgreSQL/9.1/bin/pg_restore --host localhost --port 5432 --username <USERNAME> --dbname <DATABASENAME> --no-owner --no-privileges --no-tablespaces --clean --schema public "<BACKUPFILENAME>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment