create procedure pro
as
cursor t_sor_ind is
select * from ind a where not exists(select 1 from ind@dlyx_link b where a.INDEX_NAME=b.INDEX_NAME);
cursor t_sor_tab is
select * from tab a where not exists(select 1 from tab@dlyx_link b where a.table_name=b.table_name);
cursor t_sor_cols is
select * from cols a where not exists(select 1 from cols@dlyx_link b where a.table_name=b.table_name);
....
begin
for v_sor in t_sor_ind loop
dbms_output.put_line(v_sor.index_name);
end loop;
for v_sor in t_sor_tab loop
...
end loop;
for v_sor in t_sor_cols loop
dbms_output.put_line(v_sor.column_name);
end loop;
end;
/
两个数据库建立一个链接
create database link dlyx_link CONNECT TO dlyx USING 'local';
再作一个存储过程比较:
create procedure pro
as
cursor t_sor is
select * from ind a where not exists(select 1 from dlyx_link.ind b where a.INDEX_NAME=b.INDEX_NAME);
begin
...
end;
/
大概是这种方式,比较分清谁有谁没