Skip to content

Instantly share code, notes, and snippets.

@guihatano
Last active April 13, 2020 17:19
Show Gist options
  • Save guihatano/446619d850774807a5769a3cdff625c0 to your computer and use it in GitHub Desktop.
Save guihatano/446619d850774807a5769a3cdff625c0 to your computer and use it in GitHub Desktop.
Restore database with pg_restore

pg_restore --verbose --clean --no-acl --no-owner -n public -h db -U loldesign -d mcr_development --port 5432 ./dbdump

On Docker

docker-compose run mcr pg_restore --verbose --clean --no-acl --no-owner -n public -h db -U loldesign -d mcr_development --port 5432 ./dbdump

With text .sql bkp

cat your_dump.sql | docker exec -i your-db-container psql -U postgres

Backup database:

docker exec -t your-db-container pg_dumpall -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

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