Skip to content

Instantly share code, notes, and snippets.

@moraisaugusto
Created November 26, 2019 13:56
Show Gist options
  • Save moraisaugusto/c1d6cd2c6d0dd67b03f2d9119d095539 to your computer and use it in GitHub Desktop.
Save moraisaugusto/c1d6cd2c6d0dd67b03f2d9119d095539 to your computer and use it in GitHub Desktop.
Postgresql - Dump and Restore
# to perform a dump with only the Data, not the schema ( using SSL)
$ PGSSLMODE=allow pg_dump -v -Fc --data-only -h HOST -p 5432 -U USERNAME DB_NAME --exclude-table-data NOT_THIS_TABLE > testing-data-only.sql
# to restore the dump
$ pg_restore -h localhost -p 5432 -U USERNAME -d DB_NAME < testing-data-only.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment