11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

146 CHAPTER 3 ■ DATABASE ADMINISTRATIONSQL>select c.owner,2 c.comparison_name,3 c.schema_name,4 c.object_name,5 s.current_diff_count6 from dba_comparison , dba_comparison_scan_summary s7 where c.comparison_name = s.comparison_name and8 c.owner = s.owner and9 s.scan_id = 1;OWNER COMP_NAME SCHEMA_NAME OBJECT_NAME CURRENT_DIF_COUNT------- ---------- ------------- ------------ -----------------SYSTEM COMP1 SCOTT EMP 3SQL>The current_diff_count column from the DBA_COMPARISON_SCAN_SUMMARY viewshows that there are three rows that are different between the emp table in the or<strong>11</strong> databaseand the emp table in the tenner database. The differences could be because a row is present inone but not the other database, or the row is present in both databases but with different datain the row.Converging DataSince we’ve discovered a data divergence between the local and the remote databases, we maywant to synchronize the emp table in the two databases so they have identical data. You do thisby using the converge procedure of the DBMS_COMPARISON package, as shown here:1. Connect to the remote database from the local database as the system owner, who happensto be the owner of the database link that we created earlier between the two databases:$ sqlplus sytem/sammyy1@or<strong>11</strong>SQL>2. Execute the converge procedure of the DBMS_COMPARISON package to synchronize thedata between the two databases:SQL> declare2 scan_info DBMS_COMPARISON.COMPARISON_TYPE;3 begin4 DBMS_COMPARISON.CONVERGE(5 comparison_name => 'comp1',6 scan_id => 4,7 scan_info => scan_info,8 converge_options => DBMS_COMPARISON.CMP_CONVERGE_LOCAL_WINS);9 DBMS_OUTPUT.PUT_LINE('Local Rows Merged:'||scan_info.loc_rows_merged);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!