注册
oracle和达梦数据库比对(EXCEL数据对比方法)
专栏/技术分享/ 文章详情 /

oracle和达梦数据库比对(EXCEL数据对比方法)

孤独的熊猫 2026/04/24 36 0 0
摘要

1、分别在源Oracle和目标达梦ecology_target下执行
declare num number;
begin
select count(1) into num from user_tables where table_name = ‘TMP_GET_ACTURAL_TABLE_COUNT’;
if num > 0 then
execute immediate ‘drop table TMP_GET_ACTURAL_TABLE_COUNT’;
end if;
end;
/
create table TMP_GET_ACTURAL_TABLE_COUNT(table_name varchar(100),table_cnt int);
/
CREATE OR REPLACE PROCEDURE “GET_ACTURAL_TABLE_COUNT”(isrun integer) AUTHID CURRENT_USER IS
sqlstr varchar2(4000);
begin
for cursor_sql in(
select ‘insert into TMP_GET_ACTURAL_TABLE_COUNT(table_name,table_cnt) select ‘’’||table_name||’’’ as table_name,count(1) as table_cnt from “’||table_name||’”’ as sqlstr1 from user_tables
where table_name not like ‘SREF_CON_%’
) loop
execute immediate (cursor_sql.sqlstr1);
commit;
end loop;
end;
/
truncate table TMP_GET_ACTURAL_TABLE_COUNT;
/
call GET_ACTURAL_TABLE_COUNT(1);
/
commit;
/
select *from TMP_GET_ACTURAL_TABLE_COUNT order by upper(table_name);
/
oracle
image.png
DM
image.png
2、将结果导入excel比对数据
6f43548560a849d68a86c0b00289b9ef.png
104ec38ed3304864bfdce7b26fbe506b.png

F2列,点击图片红框内的小绿点,将列应用到其他行
=IFERROR(VLOOKUP(D2,A:A:B,2,FALSE),“表不存在”)
9251e418459145c89352892168140d1f.png
3e0a22bc143446899199d2cde696e0ee.png!
G2列
=IF(VALUE(E2)=VALUE(F2),0,1)
2c87d0c7eddd4417a6e5d74e30c00409.png

将G2列,结果为1的的筛选出来就是表行数不一致的表,如果结果集都是0证明数据行数一致;

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服