加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在PostgreSQL数据库中安装pageinspect extension

发布时间:2020-12-13 16:40:12 所属栏目:百科 来源:网络整理
导读:[root@pgserver contrib]# ls -lrt | grep pagedrwxrwxrwx. 4 1107 1107 4096 Jul 10 2017 pageinspect[root@pgserver contrib]# pwd/home/postgresql-10beta2/contrib[root@pgserver contrib]# cd pageinspect/[root@pgserver pageinspect]# lltotal 132-rw
[root@pgserver contrib]# ls -lrt | grep page
drwxrwxrwx. 4 1107 1107 4096 Jul 10  2017 pageinspect
[root@pgserver contrib]# pwd
/home/postgresql-10beta2/contrib
[root@pgserver contrib]# cd pageinspect/
[root@pgserver pageinspect]# ll
total 132
-rw-r--r--. 1 1107 1107 10455 Jul 10  2017 brinfuncs.c
-rw-r--r--. 1 1107 1107 15057 Jul 10  2017 btreefuncs.c
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 expected
-rw-r--r--. 1 1107 1107  1572 Jul 10  2017 fsmfuncs.c
-rw-r--r--. 1 1107 1107  7590 Jul 10  2017 ginfuncs.c
-rw-r--r--. 1 1107 1107 15740 Jul 10  2017 hashfuncs.c
-rw-r--r--. 1 1107 1107 12540 Jul 10  2017 heapfuncs.c
-rw-r--r--. 1 1107 1107   772 Jul 10  2017 Makefile
-rw-r--r--. 1 1107 1107   560 Jul 10  2017 pageinspect--1.0--1.1.sql
-rw-r--r--. 1 1107 1107   562 Jul 10  2017 pageinspect--1.1--1.2.sql
-rw-r--r--. 1 1107 1107  1946 Jul 10  2017 pageinspect--1.2--1.3.sql
-rw-r--r--. 1 1107 1107  2566 Jul 10  2017 pageinspect--1.3--1.4.sql
-rw-r--r--. 1 1107 1107  1347 Jul 10  2017 pageinspect--1.4--1.5.sql
-rw-r--r--. 1 1107 1107  2252 Jul 10  2017 pageinspect--1.5--1.6.sql
-rw-r--r--. 1 1107 1107  6262 Jul 10  2017 pageinspect--1.5.sql
-rw-r--r--. 1 1107 1107   173 Jul 10  2017 pageinspect.control
-rw-r--r--. 1 1107 1107   522 Jul 10  2017 pageinspect.h
-rw-r--r--. 1 1107 1107  1116 Jul 10  2017 pageinspect--unpackaged--1.0.sql
-rw-r--r--. 1 1107 1107  8319 Jul 10  2017 rawpage.c
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 sql
[root@pgserver pageinspect]# ls -lrt
total 132
-rw-r--r--. 1 1107 1107  8319 Jul 10  2017 rawpage.c
-rw-r--r--. 1 1107 1107  1116 Jul 10  2017 pageinspect--unpackaged--1.0.sql
-rw-r--r--. 1 1107 1107   522 Jul 10  2017 pageinspect.h
-rw-r--r--. 1 1107 1107   173 Jul 10  2017 pageinspect.control
-rw-r--r--. 1 1107 1107  6262 Jul 10  2017 pageinspect--1.5.sql
-rw-r--r--. 1 1107 1107  2252 Jul 10  2017 pageinspect--1.5--1.6.sql
-rw-r--r--. 1 1107 1107  1347 Jul 10  2017 pageinspect--1.4--1.5.sql
-rw-r--r--. 1 1107 1107  2566 Jul 10  2017 pageinspect--1.3--1.4.sql
-rw-r--r--. 1 1107 1107  1946 Jul 10  2017 pageinspect--1.2--1.3.sql
-rw-r--r--. 1 1107 1107   562 Jul 10  2017 pageinspect--1.1--1.2.sql
-rw-r--r--. 1 1107 1107   560 Jul 10  2017 pageinspect--1.0--1.1.sql
-rw-r--r--. 1 1107 1107   772 Jul 10  2017 Makefile
-rw-r--r--. 1 1107 1107 12540 Jul 10  2017 heapfuncs.c
-rw-r--r--. 1 1107 1107 15740 Jul 10  2017 hashfuncs.c
-rw-r--r--. 1 1107 1107  7590 Jul 10  2017 ginfuncs.c
-rw-r--r--. 1 1107 1107  1572 Jul 10  2017 fsmfuncs.c
-rw-r--r--. 1 1107 1107 15057 Jul 10  2017 btreefuncs.c
-rw-r--r--. 1 1107 1107 10455 Jul 10  2017 brinfuncs.c
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 sql
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 expected
[root@pgserver pageinspect]# pwd
/home/postgresql-10beta2/contrib/pageinspect
[root@pgserver pageinspect]# ls -lrt
total 132
-rw-r--r--. 1 1107 1107  8319 Jul 10  2017 rawpage.c
-rw-r--r--. 1 1107 1107  1116 Jul 10  2017 pageinspect--unpackaged--1.0.sql
-rw-r--r--. 1 1107 1107   522 Jul 10  2017 pageinspect.h
-rw-r--r--. 1 1107 1107   173 Jul 10  2017 pageinspect.control
-rw-r--r--. 1 1107 1107  6262 Jul 10  2017 pageinspect--1.5.sql
-rw-r--r--. 1 1107 1107  2252 Jul 10  2017 pageinspect--1.5--1.6.sql
-rw-r--r--. 1 1107 1107  1347 Jul 10  2017 pageinspect--1.4--1.5.sql
-rw-r--r--. 1 1107 1107  2566 Jul 10  2017 pageinspect--1.3--1.4.sql
-rw-r--r--. 1 1107 1107  1946 Jul 10  2017 pageinspect--1.2--1.3.sql
-rw-r--r--. 1 1107 1107   562 Jul 10  2017 pageinspect--1.1--1.2.sql
-rw-r--r--. 1 1107 1107   560 Jul 10  2017 pageinspect--1.0--1.1.sql
-rw-r--r--. 1 1107 1107   772 Jul 10  2017 Makefile
-rw-r--r--. 1 1107 1107 12540 Jul 10  2017 heapfuncs.c
-rw-r--r--. 1 1107 1107 15740 Jul 10  2017 hashfuncs.c
-rw-r--r--. 1 1107 1107  7590 Jul 10  2017 ginfuncs.c
-rw-r--r--. 1 1107 1107  1572 Jul 10  2017 fsmfuncs.c
-rw-r--r--. 1 1107 1107 15057 Jul 10  2017 btreefuncs.c
-rw-r--r--. 1 1107 1107 10455 Jul 10  2017 brinfuncs.c
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 sql
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 expected
[root@pgserver pageinspect]# su - postgres
Last login: Mon Apr 16 02:38:05 EDT 2018 on pts/1
[postgres@pgserver ~]$ cd /home/postgresql-10beta2/contrib/pageinspect
[postgres@pgserver pageinspect]$ ls -lrt
total 132
-rw-r--r--. 1 1107 1107  8319 Jul 10  2017 rawpage.c
-rw-r--r--. 1 1107 1107  1116 Jul 10  2017 pageinspect--unpackaged--1.0.sql
-rw-r--r--. 1 1107 1107   522 Jul 10  2017 pageinspect.h
-rw-r--r--. 1 1107 1107   173 Jul 10  2017 pageinspect.control
-rw-r--r--. 1 1107 1107  6262 Jul 10  2017 pageinspect--1.5.sql
-rw-r--r--. 1 1107 1107  2252 Jul 10  2017 pageinspect--1.5--1.6.sql
-rw-r--r--. 1 1107 1107  1347 Jul 10  2017 pageinspect--1.4--1.5.sql
-rw-r--r--. 1 1107 1107  2566 Jul 10  2017 pageinspect--1.3--1.4.sql
-rw-r--r--. 1 1107 1107  1946 Jul 10  2017 pageinspect--1.2--1.3.sql
-rw-r--r--. 1 1107 1107   562 Jul 10  2017 pageinspect--1.1--1.2.sql
-rw-r--r--. 1 1107 1107   560 Jul 10  2017 pageinspect--1.0--1.1.sql
-rw-r--r--. 1 1107 1107   772 Jul 10  2017 Makefile
-rw-r--r--. 1 1107 1107 12540 Jul 10  2017 heapfuncs.c
-rw-r--r--. 1 1107 1107 15740 Jul 10  2017 hashfuncs.c
-rw-r--r--. 1 1107 1107  7590 Jul 10  2017 ginfuncs.c
-rw-r--r--. 1 1107 1107  1572 Jul 10  2017 fsmfuncs.c
-rw-r--r--. 1 1107 1107 15057 Jul 10  2017 btreefuncs.c
-rw-r--r--. 1 1107 1107 10455 Jul 10  2017 brinfuncs.c
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 sql
drwxrwxrwx. 2 1107 1107    86 Jul 10  2017 expected
[postgres@pgserver pageinspect]$ make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o rawpage.o rawpage.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o heapfuncs.o heapfuncs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o btreefuncs.o btreefuncs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o fsmfuncs.o fsmfuncs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o brinfuncs.o brinfuncs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o ginfuncs.o ginfuncs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE    -c -o hashfuncs.o hashfuncs.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -shared -o pageinspect.so rawpage.o heapfuncs.o btreefuncs.o fsmfuncs.o brinfuncs.o ginfuncs.o hashfuncs.o  -L../../src/port -L../../src/common -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags  
[postgres@pgserver pageinspect]$ make install
/usr/bin/mkdir -p '/usr/local/pgsql/lib'
/usr/bin/mkdir -p '/usr/local/pgsql/share/extension'
/usr/bin/mkdir -p '/usr/local/pgsql/share/extension'
/usr/bin/install -c -m 755  pageinspect.so '/usr/local/pgsql/lib/pageinspect.so'
/usr/bin/install: cannot create regular file ‘/usr/local/pgsql/lib/pageinspect.so’: Permission denied
make: *** [install-lib-shared] Error 1
[postgres@pgserver pageinspect]$ exit
logout
[root@pgserver pageinspect]# pwd
/home/postgresql-10beta2/contrib/pageinspect
[root@pgserver pageinspect]# ll
total 264
-rw-r--r--. 1     1107     1107 10455 Jul 10  2017 brinfuncs.c
-rw-rw-r--  1 postgres postgres 11264 Apr 16 07:11 brinfuncs.o
-rw-r--r--. 1     1107     1107 15057 Jul 10  2017 btreefuncs.c
-rw-rw-r--  1 postgres postgres 15328 Apr 16 07:11 btreefuncs.o
drwxrwxrwx. 2     1107     1107    86 Jul 10  2017 expected
-rw-r--r--. 1     1107     1107  1572 Jul 10  2017 fsmfuncs.c
-rw-rw-r--  1 postgres postgres  3040 Apr 16 07:11 fsmfuncs.o
-rw-r--r--. 1     1107     1107  7590 Jul 10  2017 ginfuncs.c
-rw-rw-r--  1 postgres postgres  8992 Apr 16 07:11 ginfuncs.o
-rw-r--r--. 1     1107     1107 15740 Jul 10  2017 hashfuncs.c
-rw-rw-r--  1 postgres postgres 14704 Apr 16 07:11 hashfuncs.o
-rw-r--r--. 1     1107     1107 12540 Jul 10  2017 heapfuncs.c
-rw-rw-r--  1 postgres postgres 10320 Apr 16 07:11 heapfuncs.o
-rw-r--r--. 1     1107     1107   772 Jul 10  2017 Makefile
-rw-r--r--. 1     1107     1107   560 Jul 10  2017 pageinspect--1.0--1.1.sql
-rw-r--r--. 1     1107     1107   562 Jul 10  2017 pageinspect--1.1--1.2.sql
-rw-r--r--. 1     1107     1107  1946 Jul 10  2017 pageinspect--1.2--1.3.sql
-rw-r--r--. 1     1107     1107  2566 Jul 10  2017 pageinspect--1.3--1.4.sql
-rw-r--r--. 1     1107     1107  1347 Jul 10  2017 pageinspect--1.4--1.5.sql
-rw-r--r--. 1     1107     1107  2252 Jul 10  2017 pageinspect--1.5--1.6.sql
-rw-r--r--. 1     1107     1107  6262 Jul 10  2017 pageinspect--1.5.sql
-rw-r--r--. 1     1107     1107   173 Jul 10  2017 pageinspect.control
-rw-r--r--. 1     1107     1107   522 Jul 10  2017 pageinspect.h
-rwxrwxr-x  1 postgres postgres 48984 Apr 16 07:11 pageinspect.so
-rw-r--r--. 1     1107     1107  1116 Jul 10  2017 pageinspect--unpackaged--1.0.sql
-rw-r--r--. 1     1107     1107  8319 Jul 10  2017 rawpage.c
-rw-rw-r--  1 postgres postgres 10736 Apr 16 07:11 rawpage.o
drwxrwxrwx. 2     1107     1107    86 Jul 10  2017 sql
[root@pgserver pageinspect]# make install
/usr/bin/mkdir -p '/usr/local/pgsql/lib'
/usr/bin/mkdir -p '/usr/local/pgsql/share/extension'
/usr/bin/mkdir -p '/usr/local/pgsql/share/extension'
/usr/bin/install -c -m 755  pageinspect.so '/usr/local/pgsql/lib/pageinspect.so'
/usr/bin/install -c -m 644 ./pageinspect.control '/usr/local/pgsql/share/extension/'
/usr/bin/install -c -m 644 ./pageinspect--1.5.sql ./pageinspect--1.5--1.6.sql ./pageinspect--1.4--1.5.sql ./pageinspect--1.3--1.4.sql ./pageinspect--1.2--1.3.sql ./pageinspect--1.1--1.2.sql ./pageinspect--1.0--1.1.sql ./pageinspect--unpackaged--1.0.sql  '/usr/local/pgsql/share/extension/'
[root@pgserver pageinspect]# 

[root@pgserver pageinspect]# su - postgres
Last login: Mon Apr 16 07:11:09 EDT 2018 on pts/1
[postgres@pgserver ~]$ psql
psql (10beta2)
Type "help" for help.

postgres=# create extension pageinspect;
CREATE EXTENSION
postgres=# 

postgres=# d pg_extension;
              Table "pg_catalog.pg_extension"
     Column     |  Type   | Collation | Nullable | Default 
----------------+---------+-----------+----------+---------
 extname        | name    |           | not null | 
 extowner       | oid     |           | not null | 
 extnamespace   | oid     |           | not null | 
 extrelocatable | boolean |           | not null | 
 extversion     | text    |           | not null | 
 extconfig      | oid[]   |           |          | 
 extcondition   | text[]  |           |          | 
Indexes:
    "pg_extension_name_index" UNIQUE,btree (extname)
    "pg_extension_oid_index" UNIQUE,btree (oid)

postgres=# select extName from pg_extension;
   extname   
-------------
 plpgsql
 pageinspect
(2 rows)

postgres=# SELECT * FROM page_header(get_raw_page('pg_class',0));
    lsn    | checksum | flags | lower | upper | special | pagesize | version | prune_xid 
-----------+----------+-------+-------+-------+---------+----------+---------+-----------
 0/17F6748 |        0 |     1 |   220 |  7264 |    8192 |     8192 |       4 |         0
(1 row)

postgres=#
关于pageinspect : https://www.postgresql.org/docs/10/static/pageinspect.html
http://blog.163.com/digoal@126/blog/static/16387704020114273265960/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读