Last active
November 21, 2023 19:35
-
-
Save iKlotho/e304e370eeca784b8334b15d9704f632 to your computer and use it in GitHub Desktop.
PostgreSQL Dump [Docker]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dump from docker | |
docker exec dbname dockerinstance -d postgres -Fc -U postgres > dump.sql | |
# finding dump encoding | |
file dump.sql | |
# Output> dump.sql: Little-endian UTF-16 Unicode text, with very long lines, with CRLF line terminators | |
# convert it to utf-8 | |
iconv -f utf-16 -t utf-8 dumb.sql > dumb-utf8.sql | |
# restore the db | |
cat .\dump.sql | docker exec -i dockerinstance psql dbname -U db_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment