前奏
make: /opt/rh/llvm-toolset-7/root/bin/clang: Command not found
make: *** [pg_logminer.bc] Error 127
cd /app/pg/pg_156_5432/postgresql/lib/postgresql/pgxs/src/makefiles/
vi pgxs.mk
#ifeq ($(with_llvm), yes)
#all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS))
#endif
#ifeq ($(with_llvm), yes)
# $(foreach mod, $(MODULES), $(call install_llvm_module,$(mod),$(mod).bc))
#endif # with_llvm
#ifeq ($(with_llvm), yes)
# $(call install_llvm_module,$(MODULE_big),$(OBJS))
#endif # with_llvm
#ifeq ($(with_llvm), yes)
# $(foreach mod, $(MODULES), $(call uninstall_llvm_module,$(mod)))
#endif # with_llvm
#ifeq ($(with_llvm), yes)
# $(call uninstall_llvm_module,$(MODULE_big))
#endif # with_llvm
1.2 重新编译,记得刷新postgresql环境变量
/usr/bin/mkdir -p /app/pg/pg_156_5432/postgresql/lib/postgresql
/usr/bin/mkdir -p /app/pg/pg_156_5432/postgresql/share/postgresql/extension
/usr/bin/mkdir -p /app/pg/pg_156_5432/postgresql/share/postgresql/extension
/usr/bin/install -c -m 755 walminer.so /app/pg/pg_156_5432/postgresql/lib/postgresql/walminer.so
/usr/bin/install -c -m 644 .//walminer.control /app/pg/pg_156_5432/postgresql/share/postgresql/extension/
/usr/bin/install -c -m 644 .//walminer--1.0.sql /app/pg/pg_156_5432/postgresql/share/postgresql/extension/
postgres=# create extension walminer;
CREATE EXTENSION
postgres=# dx
List of installed extensions
Name | Version | Schema | Description
--------------------+---------+------------+-----------------------------------------------------------
pg_stat_statements | 1.7 | public | track execution statistics of all SQL statements executed
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
telepg_monitor | 2.7.6 | public | Expansion monitoring module
walminer | 1.0 | public | inspect the contents of database pages at a low level
解析步骤
postgres=# select walminer_wal_add(/app/pg/data_156_5432/data/pg_wal);
NOTICE: Get data dictionary from current database.
walminer_wal_add
---------------------
13 file add success
(1 row)
postgres=# select walminer_wal_list();
walminer_wal_list
---------------------------------------------------------------
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000001)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000002)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000003)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000004)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000005)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000006)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000007)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000008)
(/app/pg/data_156_5432/data/pg_wal/000000010000000000000009)
(/app/pg/data_156_5432/data/pg_wal/00000001000000000000000A)
(/app/pg/data_156_5432/data/pg_wal/00000001000000000000000B)
(/app/pg/data_156_5432/data/pg_wal/00000001000000000000000C)
(/app/pg/data_156_5432/data/pg_wal/00000001000000000000000D)
(13 rows)
postgres=# select walminer_start(null,null,0,0);
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000001
NOTICE: wal record after time 2022-02-24 18:17:44+08 or 0/166aff0 will be analyse completely
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000002
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000003
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000004
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000005
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000006
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000007
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000008
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/000000010000000000000009
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/00000001000000000000000A
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/00000001000000000000000B
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/00000001000000000000000C
NOTICE: Change Wal Segment To:/app/pg/data_156_5432/data/pg_wal/00000001000000000000000D
walminer_start
---------------------
walminer sucessful!
(1 row)
postgres=# select * from walminer_contents;
-[ RECORD 1 ]-----+-------------------------------------------------------------
xid | 609
virtualxid | 1
timestamptz | 2022-06-13 16:25:42.259986+08
record_database | postgres
record_user | root
record_tablespace | pg_default
record_schema | public
op_type | INSERT
op_text | INSERT INTO "public"."test"("id") VALUES(1);
op_undo | DELETE FROM "public"."test" WHERE "id"=1 AND ctid = (0,1);
lsn | 0/DAA6138
commit_end_lsn | 0/DAA61A8
walminer_contents字段含义:
select walminer_stop();
常规操作
select walminer_by_time(starttime, endtime);
select walminer_by_xid(xid,true,reloid);
注:true和‘false’代表是否为精确解析模式,reloid为目标表的oid(注意不是relfilenode)
适用性
4.2 使用注意事项
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/129118.html
postgresql 10主备流复制测试 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; ...
postgresql10主备流复制测试 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; ...
阅读 1343·2023-01-11 13:20
阅读 1679·2023-01-11 13:20
阅读 1130·2023-01-11 13:20
阅读 1852·2023-01-11 13:20
阅读 4095·2023-01-11 13:20
阅读 2703·2023-01-11 13:20
阅读 1383·2023-01-11 13:20
阅读 3590·2023-01-11 13:20