pg_dump -C -h localhost -U user_name database_name | psql -h 10.590.8.46 -U user_name database_name
我正在尝试将数据库转储到linux上的远程服务器,这是我不断得到的错误:
pg_dump: [archiver (db)] connection to database "database_name" failed:
FATAL: invalid command-line argument for server process: -I
HINT: Try "postgres --help" for more information.
答案 0 :(得分:0)
我可以重现此行为的唯一方法是设置PGOPTIONS
环境变量:
export PGOPTIONS=-I
检查是否设置了该变量,如果是,则使用
取消设置unset PGOPTIONS
答案 1 :(得分:-1)
您可以查看此帖子pg_dump postgres database from remote server
从远程转储数据库的命令是
ssh user@remote_machine "pg_dump -U dbuser -h localhost database_name " \
>> backup_file_on_your_local_machine.sql