Skip to content

Instantly share code, notes, and snippets.

@sivakumarbdu
Last active December 31, 2019 07:30
Show Gist options
  • Save sivakumarbdu/2844df9183412f9d5594c8995a41c8d0 to your computer and use it in GitHub Desktop.
Save sivakumarbdu/2844df9183412f9d5594c8995a41c8d0 to your computer and use it in GitHub Desktop.
pg_dump -F c -h localhost -U pg_user -d db_name | gzip -c > sql_dump.gz
#-F format c -> custom
#Restore
pg_restore -U username -d db_name -v dumpfile_location -h localhost
#Export specific table
pg_dump -h host_name -U username --table=schema_migrations --data-only --column-inserts table_name > data.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment