前奏
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 使用注意事項
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/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%; ...
閱讀 1347·2023-01-11 13:20
閱讀 1685·2023-01-11 13:20
閱讀 1133·2023-01-11 13:20
閱讀 1860·2023-01-11 13:20
閱讀 4101·2023-01-11 13:20
閱讀 2705·2023-01-11 13:20
閱讀 1386·2023-01-11 13:20
閱讀 3599·2023-01-11 13:20