【问题标题】:Error using pg_upgrade going from PostgreSQL 10 to 12使用 pg_upgrade 从 PostgreSQL 10 升级到 12 时出错
【发布时间】:2020-12-15 19:01:14
【问题描述】:

我安装了 PostgreSQL 10,并且刚刚安装了 PostgreSQL 12(在 Windows 上)。我正在尝试使用pg_upgrade 迁移数据库。但是,我遇到了一个恼人的错误:

我运行的命令如下:

$ pg_upgrade.exe -b 'C:\Program Files\PostgreSQL\10\bin\' -B 'C:\Program Files\PostgreSQL\12\bin\
' -d 'C:\Program Files\PostgreSQL\10\data\' -D 'C:\Program Files\PostgreSQL\12\data\'

但是,我收到错误消息:

You must identify the directory where the new cluster binaries reside.
Please use the -B command-line option or the PGBINNEW environment variable.
Failure, exiting

...尽管显然这样做了。

有人见过这个吗?

【问题讨论】:

  • 您是否尝试过使用正斜杠或加倍反斜杠? (MS-寡妇)

标签: windows postgresql postgresql-12 pg-upgrade


【解决方案1】:

来自步骤“9) 中的“对于 Windows 用户 ..”用户部分,在 this page 运行 pg_upgrade:

对于 Windows 用户,您必须登录到管理帐户,然后以 postgres 用户身份启动 shell 并设置正确的路径:

RUNAS /USER:postgres "CMD.EXE"
SET PATH=%PATH%;C:\Program Files\PostgreSQL\12\bin;

然后使用引用目录运行 pg_upgrade,例如:

pg_upgrade.exe
   --old-datadir "C:/Program Files/PostgreSQL/9.6/data"
   --new-datadir "C:/Program Files/PostgreSQL/12/data"
   --old-bindir "C:/Program Files/PostgreSQL/9.6/bin"
   --new-bindir "C:/Program Files/PostgreSQL/12/bin"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-08
    • 1970-01-01
    • 2016-03-19
    • 1970-01-01
    • 2012-06-10
    • 1970-01-01
    • 2022-01-10
    相关资源
    最近更新 更多