备份时,修改powershell的编码为utf-8
powershell -NoExit -Command "chcp 65001"
备份完,用notepad打开,确认一下内容是不是utf-8,如果出现utf-16,手动转一下编码为utf-8。
备份:
.\pg_dump -h 127.0.0.1 -E utf8 -p 5432 -U postgres -d 数据库名称 > C:\db_bak.bak
还原:
psql –h 127.0.0.1 -p 5432 -U postgres -d 数据库名称 –f db_bak.bak