当前位置: 代码迷 >> Sql Server >> 请教怎样能对比两个DB阿,小弟我们有两个测试用的SQL SERVER系统,怎样才能对比他们的数据库的区别
  详细解决方案

请教怎样能对比两个DB阿,小弟我们有两个测试用的SQL SERVER系统,怎样才能对比他们的数据库的区别

热度:40   发布时间:2016-04-27 15:03:57.0
请问怎样能对比两个DB阿,我们有两个测试用的SQL SERVER系统,怎样才能对比他们的数据库的区别。
有专门的软件可以对比吗,谢谢。。。。

------解决方案--------------------
SQL code
select case when a.cnt = b.cnt then '两个库结构一致' when a.cnt <> b.cnt then '两个库结构不一致' end from (select count(*) as cnt from dba_tab_columns t1, [email protected]_db2 t2 where t1.owner = 'TAOBAO' and t1.owner = t2.owner and t1.table_name = t2.table_name and t1.column_name = t2.column_name and t1.data_type = t2.data_type and t1.data_length = t2.data_length and t1.nullable = t2.nullable and nvl(t1.data_precision, 0) = nvl(t2.data_precision, 0) and nvl(t1.data_scale, 0) = nvl(t2.data_scale, 0)) a, (select count(*) as cnt from dba_tab_columns where owner = 'TAOBAO') b
  相关解决方案