Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ bug ]oracle的sql上线,备份的sql异常。 #1467

Closed
thcoffee opened this issue Apr 15, 2022 · 8 comments · Fixed by #1488
Closed

[ bug ]oracle的sql上线,备份的sql异常。 #1467

thcoffee opened this issue Apr 15, 2022 · 8 comments · Fixed by #1488

Comments

@thcoffee
Copy link
Contributor

oracle 的sql上线的时候,备份用logminer去抓undo的sql 。如果sql巨长会自动变成2行。 archery获取回退sql的时候就会发现串行了,一个完整的sql被拆分成了2个sql。希望能进行修复。谢谢。

版本信息

应用版本/分支:v1.8.3

部署方式:Docker

@unknowissue
Copy link
Contributor

能举例说明一下么?
给个测试demo?

@thcoffee
Copy link
Contributor Author

能举例说明一下么? 给个测试demo?

image

@thcoffee
Copy link
Contributor Author

thcoffee commented Apr 17, 2022

能举例说明一下么? 给个测试demo?

logminer分析redo的时候生成的字典对超长的sql会截成2行。查V$LOGMNR_CONTENTS的时候需要多行才能拼成一个完整的sql。表很多字段、内容又特别长的就容易这样。

@thcoffee
Copy link
Contributor Author

thcoffee commented Apr 18, 2022

image
V$LOGMNR_CONTENTS确定唯一行
1、rs_id,ssn确定唯一行,Order by t.scn,t.rs_id,t.ssn基本可以确定sql在redo里的执行顺序
2、csf是sql_redo过长(超过4000字节)其值就为1,从第一个csf=1到最后一个cdf=0代表完整的一行。

@peng19832
Copy link
Contributor

能举例说明一下么? 给个测试demo?

这个问题,我也遇到了#1249
不止长sql有问题,还会打印出不相关的语句

@thcoffee
Copy link
Contributor Author

thcoffee commented Apr 28, 2022

select
xmlagg(xmlparse(content sql_redo) order by scn,rs_id,ssn,rownum).getclobval() ,
xmlagg(xmlparse(content sql_undo) order by scn,rs_id,ssn,rownum).getclobval()
from v$logmnr_contents
where SEG_OWNER not in ('SYS','SYSTEM')
and session# = (select sid from v$mystat where rownum = 1)
and serial# = (select serial# from v$session s where s.sid = (select sid from v$mystat where rownum = 1 ))
group by scn,rs_id,ssn order by scn desc;

我把获取undo的那个语句改了一下,这样写的话就可以获取完整的超长sql了。
之前
image
之后
image

@unknowissue
Copy link
Contributor

select xmlagg(xmlparse(content sql_redo) order by scn,rs_id,ssn,rownum).getclobval() , xmlagg(xmlparse(content sql_undo) order by scn,rs_id,ssn,rownum).getclobval() from v$logmnr_contents where SEG_OWNER not in ('SYS','SYSTEM') and session# = (select sid from v$mystat where rownum = 1) and serial# = (select serial# from v$session s where s.sid = (select sid from v$mystat where rownum = 1 )) group by scn,rs_id,ssn order by scn desc;

我把获取undo的那个语句改了一下,这样写的话就可以获取完整的超长sql了。 之前 image 之后 image

麻烦提交一个pr呗!
非常感谢!

我最近辞职了,我本地没环境

@thcoffee
Copy link
Contributor Author

thcoffee commented May 5, 2022

select xmlagg(xmlparse(content sql_redo) order by scn,rs_id,ssn,rownum).getclobval() , xmlagg(xmlparse(content sql_undo) order by scn,rs_id,ssn,rownum).getclobval() from v$logmnr_contents where SEG_OWNER not in ('SYS','SYSTEM') and session# = (select sid from v$mystat where rownum = 1) and serial# = (select serial# from v$session s where s.sid = (select sid from v$mystat where rownum = 1 )) group by scn,rs_id,ssn order by scn desc;
我把获取undo的那个语句改了一下,这样写的话就可以获取完整的超长sql了。 之前 image 之后 image

麻烦提交一个pr呗! 非常感谢!

我最近辞职了,我本地没环境

哦了,我头一次提pr,我尝试一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants