代码拉取完成,页面将自动刷新
XLogMiner是从PostgreSQL的WAL(write ahead logs)日志中解析出执行的SQL语句的工具,并能生成出对应的undo SQL语句。
alter table t1 replica identity FULL;
目前主要是在PostgreSQL 9.5.x上开发测试的,在9.6版本中仅做过简单验证,如果使用过程中发现问题欢迎向我们反馈。
make && make install
create extension xlogminer;
-- 增加wal文件:
select xlogminer_xlogfile_add('/opt/test/wal');
-- 注:参数可以为目录或者文件
-- 移除wal文件:
select xlogminer_xlogfile_remove('/opt/test/wal');
-- 注:参数可以为目录或者文件
-- 列出wal文件:
select xlogminer_xlogfile_list();
select xlogminer_start(’START_TIMSTAMP’,’STOP_TIMESTAMP’,’START_XID’,’STOP_XID’)
---如果分析全部日志:
select xlogminer_start('null','null',0,0);
两组参数只能有一组为有效输入,否则报错。
select * from xlogminer_contents;
该函数作用为释放内存,结束日志分析,该函数没有参数。
select xlogminer_stop();
要求执行解析的PostgreSQL数据库和被解析的为同一版本
create extension xlogminer;
select xlogminer_build_dictionary('/opt/proc/store_dictionary');
-- 注:参数可以为目录或者文件
create extension xlogminer;
select xlogminer_load_dictionary('/opt/test/store_dictionary');
-- 注:参数可以为目录或者文件
-- 增加wal文件:
select xlogminer_xlogfile_add('/opt/test/wal');
-- 注:参数可以为目录或者文件
-- 移除wal文件:
select xlogminer_xlogfile_remove('/opt/test/wal');
-- 注:参数可以为目录或者文件
-- 列出wal文件:
select xlogminer_xlogfile_list();
-- 注:参数可以为目录或者文件
select xlogminer_start(’START_TIMSTAMP’,’STOP_TIMESTAMP’,’START_XID’,’STOP_XID’)
select * from xlogminer_contents;
select xlogminer_stop();
注意:xlogminer_contents是xlogminer自动生成的临时表,因此当session断开再重新进入或其他session中解析数据不可见。这么做主要是基于安全考虑。 如果希望保留解析结果,可利用create xxx as select * from xlogminer_contents;写入普通表中。
发现bug或者有好的建议可以通过邮箱(opensource@highgo.com)联系我们。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。