Skip to content

Instantly share code, notes, and snippets.

@jackie-do
Last active January 4, 2018 06:51
Show Gist options
  • Save jackie-do/c66de45de634484f4a06a9f31ae654d1 to your computer and use it in GitHub Desktop.
Save jackie-do/c66de45de634484f4a06a9f31ae654d1 to your computer and use it in GitHub Desktop.
dump and restore a table
PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser -d mydb -t mytable > mydb.dump

=== RESTORE ===

psql -U boxatwork_newqa -d boxatwork_newqa -1 -f ../../../boxie24_production/shared/db_bk/store_blog_categories_april_24.dump

psql -U boxatwork_newqa -d boxatwork_newqa -1 -f store_blog_categories_april_24.dump

psql boxatwork_newqa -U boxatwork_newqa


pg_restore ../../../boxie24_production/shared/db_bk/store_blog_categories_april_24.dump -d boxatwork_newqa -U boxatwork_newqa --no-owner


pg_restore store_blog_categories_april_24.dump -d boxatwork_newqa -U boxatwork_newqa --no-owner

=== store_blogs === DUMP

PGPASSWORD='your_password' pg_dump -Fc --no-acl --no-owner -h localhost -U boxatwork_production -d boxatwork_production -t store_blogs > store_blogs_april_17.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment