set pgpassword=密码
pg_dump -h 主机 -p 端口 -U 用户 -d 数据库 -t 表 -a > 文件地址 (只备份数据)
pg_dump -h 主机 -p 端口 -U 用户 -d 数据库 -t 表 -a > 文件地址 --column-inserts (只备份数据)
备份:
pg_dump -h localhost -U postgres tt > d:/the_backup.sql
恢复:
psql -h localhost -U postgres -p 5432 data < d:/cc.sql
export pgpassword=密码
pg_dump -h 主机 -p 端口 -U 用户 -d 数据库 -t 表 -a > 文件地址 (只备份数据)
pg_dump -h 主机 -p 端口 -U 用户 -d 数据库 -t 表 -a > 文件地址 --column-inserts (只备份数据)
postgres 数据库备份和恢复 (保证pg_dump的命令是全局的)
原文:https://www.cnblogs.com/Fooo/p/13275234.html