Skip to content

Instantly share code, notes, and snippets.

@jagira
Created February 6, 2018 05:21
Show Gist options
  • Save jagira/35b2ba3a071c862e8c85cdbd3bee8003 to your computer and use it in GitHub Desktop.
Save jagira/35b2ba3a071c862e8c85cdbd3bee8003 to your computer and use it in GitHub Desktop.
Commands to take backup and restore a PostgreSQL database
# Take backup
pg_dump -F c -v DATABASE_NAME -f FILENAME.sql
# Restore from backup
pg_restore --verbose --clean --no-owner --no-acl --dbname DATABASE_NAME FILENAME.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment