Skip to content

Instantly share code, notes, and snippets.

@aamsur-mkt
Created June 18, 2020 07:52
Show Gist options
  • Save aamsur-mkt/e8510765681d7936e604c77022f21aee to your computer and use it in GitHub Desktop.
Save aamsur-mkt/e8510765681d7936e604c77022f21aee to your computer and use it in GitHub Desktop.
Backup Import Postgre
  1. Backup source
  2. Delete db target
  3. create db target
  4. import source to target

  1. pg_dump -U postgres -W -d example_backups > ~/Example_Dumps/ex_back_db.sql

  2. DROP DATABASE example_backups_target;

  3. CREATE DATABASE example_backups_target;

  4. psql -U postgres -W -d example_backups_target -f ~/Example_Dumps/ex_back_db.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment