Postgresql pg_dump: 因为服务器版本不匹配而终止

之前在生产环境部署的Postgresql为9.6版本,但最近在备份数据的时候发现他所使用的客户端居然是9.2的版本。。

# 查看已安装的postgresql程序
yum list installed |grep postgresql

# 查看Yum已安装的源
yum repolist

# 引入postgresql对应版本的源
# http://yum.postgresql.org/repopackages.php
rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm

# 查找需要的版本
yum search postgresql --enablerepo=pgdg96

# 安装对应版本的客户端
yum install -y postgresql96

# 查看执行程序路径
find / -name pg_dump -type f

# 替换低版本
ln -snf /usr/pgsql-9.6/bin/pg_dump /usr/bin/pg_dump

备份命令

su - postgres -c "pg_dump -U odoo -Fc -d Yunshang -f Yunshang.dump"

恢复命令

createdb -U odoo Yunshang
pg_restore -v -U odoo "F:\python\YunShangZhuangShi\Yunshang.dump"
  1. BestDino 2018.05.02 3:18am

    I have noticed you don’t monetize your site, don’t waste your traffic,
    you can earn extra bucks every month because you’ve got hi quality content.
    If you want to know how to make extra $$$, search for: Ercannou’s
    essential adsense alternative

  2. Martindiurf 2018.04.30 1:36pm

    Hellow my name is Martindiurf. Wery good article! Thx :)

HTML tag cannot be used in this comment.