oracle - How to validate the database after migration -
we have oracle 11g database running on amazon ec2 , trying migrate amazon rds. both source , target oracle db. best way validate tables , data in both source , target after migrating database. how make sure migrated without data loss.
thanks in advance.
create database link old_db
old database , compare data
select * tab1 minus select * tab2@old_db union select * tab1@old_db minus select * tab2@old_db
the result of select must empty
select desired tablenames by
select table_name user_tables
and build select statement above execute dynamically table table, like
declare l_found number; l_sql varchar2(500); begin l_rec in (select table_name user_tables) loop begin -- assume database link old_db exists l_sql := 'select 1 dual exists (select * ' || l_rec.table_name || ' minus select * ' || l_rec.table_name || '@old_db union ' || 'select * ' || l_rec.table_name || '@old_db minus select * ' || l_rec.table_name || ')'; dbms_output.put_line(l_sql); execute immediate l_sql l_found; dbms_output.put_line('difference found :' || l_rec.table_name); exception when no_data_found dbms_output.put_line('okay :' || l_rec.table_name); -- okay null; when others -- error (check if table exists, ...) dbms_output.put_line('error :' || l_rec.table_name); end; end loop; end;