暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

PostgreSQL源码安装之小版本升级(12.0到12.1)

原创 多米爸比 2019-12-31
2633

11之前使用pg,我一般linux下使用二进制版本,window下使用解压版本,不管是解压版还是二进制版,小版本的升级都是分钟级内,非常方便,没做过源码安装的升级,今天测一下源码方式的小版本升级,由12.0升级至12.1

1.安装pg12.0

[postgres@localhost ~]$ tar zxvf postgresql-12.0.tar.gz
[postgres@localhost ~]$ cd postgresql-12.0/
[postgres@localhost postgresql-12.0]$ ./configure --prefix=/home/postgres/pg12 --with-pgport=6001  --without-zlib
[postgres@localhost postgresql-12.0]$ make && make install
[postgres@localhost postgresql-12.0]$ /home/postgres/pg12/bin/initdb -D/home/postgres/data6001 -Upostgres
[postgres@localhost postgresql-12.0]$ cd ~
[postgres@localhost ~]$ /home/postgres/pg12/bin/pg_ctl -D /home/postgres/data6001 -l logfile start
复制

2.创建扩展oracle_fdw和测试表t1

没用过oracle_fdw的可以参考我下面这篇文章:https://www.modb.pro/db/12878
PostgreSQL外部表插件oracle_fdw

[postgres@localhost oracle_fdw-master]$ psql -p6001 -Upostgres
psql (12.0)
Type "help" for help.

postgres=# create extension oracle_fdw;
CREATE EXTENSION
postgres=# select oracle_diag();
                           oracle_diag                            
------------------------------------------------------------------
 oracle_fdw 2.2.1devel, PostgreSQL 12.0, Oracle client 11.2.0.4.0
(1 row)
postgres=# create table t1 (id int ,info text);
CREATE TABLE
postgres=# insert into t1 values(100,now());
INSERT 0 1
postgres=# select * from t1;
 id  |             info              
-----+-------------------------------
 100 | 2019-12-31 09:32:16.675456+08
(1 row)
postgres=# \q
复制

3.停pg12.0并编译12.1

[postgres@localhost oracle_fdw-master]$ cd ~
[postgres@localhost ~]$ /home/postgres/pg12/bin/pg_ctl -D /home/postgres/data6001 -l logfile stop
[postgres@localhost ~]$ tar zxvf postgresql-12.1.tar.gz
[postgres@localhost ~]$ cd postgresql-12.1/
[postgres@localhost postgresql-12.1]$ ./configure --prefix=/home/postgres/pg12 --with-pgport=6001  --without-zlib
[postgres@localhost postgresql-12.1]$ make && make install
[postgres@localhost postgresql-12.1]$ cd ~
复制

4.启动12.1并测试

[postgres@localhost ~]$ /home/postgres/pg12/bin/pg_ctl -D /home/postgres/data6001 -l logfile start
[postgres@localhost ~]$ psql -p6001 -Upostgres
psql (12.1)
Type "help" for help.

postgres=# \dx
                        List of installed extensions
    Name    | Version |   Schema   |              Description               
------------+---------+------------+----------------------------------------
 oracle_fdw | 1.1     | public     | foreign data wrapper for Oracle access
 plpgsql    | 1.0     | pg_catalog | PL/pgSQL procedural language
(2 rows)

postgres=# select oracle_diag();
                           oracle_diag                            
------------------------------------------------------------------
 oracle_fdw 2.2.1devel, PostgreSQL 12.1, Oracle client 11.2.0.4.0
(1 row)

postgres=# select * from t1;
 id  |             info              
-----+-------------------------------
 100 | 2019-12-31 09:32:16.675456+08
(1 row)
复制

可以看到旧版本安装的插件也继承过来了,实验成功。

最后修改时间:2020-01-20 14:35:22
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论