解决Windows2012 R2下安装PostgreSQL报错的问题

219 阅读3分钟

作者:类延良,任职于瀚高基础软件股份有限公司,PostgreSQL数据库技术爱好者,10g &11g OCM,OGG认证专家。

一、环境说明

1. Windows2012R2的版本见下,未打任何的OS补丁

2.采用的介质是postgresql-12.5-1-windows-x64.exe,从EDB公司下载的介质,已经验算过该介质的SHA256,没问题。

3. PostgreSQL12 x64bit是支持Windows 2102R2的,如下截图来自

www.postgresql.org/download/wi…

二、安装报错

三、问题分析与解决

众所周知,在Windows下安装部署用C开发的程序(比如OGG,比如vmware workstations等等),都需要安装Microsoft Visual C++ 2015-2019 Redistributable,这个安装包需要说明如下:

1.该安装包的下载网址是:

support.microsoft.com/en-in/help/…

2.该安装包区分x86、x64、ARM64,请注意务必下载正确

3.该安装包对Windwos版本的要求如下,来自于网址

docs.microsoft.com/zh-cn/visua…

上述网址有如下的描述:

“Visual C++ 2015-2019 Redistributable 支持与 Visual Studio 相同的系统要求”,那么就来看Visual Studio 2019对操作系统的要求,见下:
Visual Studio 2019 将在以下操作系统上安装并运行(建议使用 64 位;不支持 ARM):

  • Windows 10 版本 1703 或更高版本:家庭版、专业版、教育版和企业版(不支持 LTSC 和 Windows 10 S)

  • Windows Server 2019:Standard 和 Datacenter

  • Windows Server 2016:Standard 和 Datacenter

  • Windows 8.1(带有更新2919355):核心板、专业版和企业版

  • Windows Server 2012 R2(更新2919355):Essentials、Standard、Datacenter

  • Windows 7 SP1(带有最新的 Windows 更新):家庭高级版、专业版、企业版、旗舰版

4. Visual C++ 2015, 2017 and 2019 all share the same redistributable files

For example, installing the Visual C++ 2019 redistributable will affect programs built with Visual C++ 2015 and 2017 also. However, installing the Visual C++ 2015 redistributable will not replace the newer versions of the files installed by the Visual C++ 2017 and 2019 redistributables.

本文摘自:support.microsoft.com/en-in/help/…

从如上分析可以看出,Visual C++ 2015-2019 Redistributable 在Windows2012R2下安装,需要Windows2012R2带有更新2919355。我特意尝试过当Windows2012R2不带任何OS补丁的情况下去安装Visual C++ 2015-2019 Redistributable,结果OS蓝屏故障,进而导致OS重启,所以,请务必为Windows2012R2安装更新2919355

下面就来为Windows2012R2安装更新2919355

Windows2012R2的更新 2919355对应的补丁下载网址

www.microsoft.com/zh-CN/downl…

如下是打补丁的顺序,请依次执行即可:

1. clearcompressionflag.exe

2. KB2919442

3. KB2975061 本补丁下载自support.microsoft.com/kb/2975061/

4. KB2919355若是不安装KB2975061,那么在安装KB2919355时将安装将失败,事件查看器中的错误代码为 0x80070005。安装KB2919355耗时1小时,需要重启OS生效。

5. KB2932046,重启os生效

6. KB2959977,重启os生效

7. KB2937592,不需要重启

8. KB2938439,重启os生效

9. KB2934018,重启os生效

以上九个步骤建议预留至少2个小时的时间进行OS补丁更新,请规划好停机时间。安装完更新2919355之后,再去运行postgresql-12.5-1-windows-x64.exe即可。

更多PostgreSQL知识问答、技术文章,请访问PGFans问答社区:www.pgfans.cn