开启数据库归档模式并设置归档路径
wal_level = logical --注:此处设置为archive将无法完整挖掘操作记录,需设置为logical
archive_mode = on
archive_directory ='/home/lirui/arch'
create table test (id int,namevarchar(2));
insert into test values (1,'aa');
insert into test values (2,'bb');
将表设置为full模式
alter table test replica identityFULL;
切换xlog
select pg_switch_xlog();
生成数据字典
select xlogminer_build_dictionary('/home/lirui/arch');
添加xlog日志文件
增加wal文件:
select xlogminer_xlogfile_add('/home/lirui/arch');
移除wal文件:
select xlogminer_xlogfile_remove('/home/lirui/arch');
列出wal文件:
select xlogminer_xlogfile_list();
执行解析
select xlogminer_start('NULL','NULL','0','0');
解析结果查看(确认可挖掘出相关的DML语句机器undo语句)
select * from xlogminer_contents;
数据清除
select xlogminer_stop();