Simple DML operations:
Before we start, we should ensure, that replication is setup correctly and is running. Connect to dbvrep console using script start-console.sh on either source or target machine:
...
No Format | ||
---|---|---|
| ||
[oracle@source replicate]$ sqlplus repoe/repoe@TARGET SQL> set lines 200 pages 999 SQL> select * from REPOE.CARD_DETAILS where card_type='REPOE_TEST'; CARD_ID CUSTOMER_ID CARD_TYPE CARD_NUMBER EXPIRY_DATE I SECURITY_CODE ---------- ----------- ------------------------------ ----------- ------------------ - ------------- 750004 1287 REPOE_TEST 9102450385 25-MAY-17 Y 1000 |
Simple DDL operation
Let's try a bit more complex command - Create table as select:
No Format | ||
---|---|---|
| ||
[oracle@source replicate]$ sqlplus repoe/repoe@TARGETrepoe@SOURCE REPOE@SOURCE> create table repoe.tables as select * from user_tables; Table created. |
...
No Format | ||
---|---|---|
| ||
SQL> conn system/manager@target
Connected.
SQL> select * from repoe.tables
minus
select * from repoe.tables@source
union all
select * from repoe.tables@source
minus
select * from repoe.tables
/
no rows selected
SQL> |
This query uses database link created before and checks for any rows, that are in source database and are not present in target database and vice versa. If it returns some rows, than something bad happened.
Batch DML operation:
Lets update all rows in REPOE.TABLES table on SOURCE database:
...
From this output, you can see, that one command, that was run on source database and changes 11 rows, created 11 single row changes. Replicate is not replicating commands, but only rows changed.
You can again check for any discrepancies during replication by following command:
No Format | ||
---|---|---|
| ||
SQL> conn system/manager@target
Connected.
SQL> select * from repoe.tables
minus
select * from repoe.tables@source
union all
select * from repoe.tables@source
minus
select * from repoe.tables
/
no rows selected
SQL> |
Cleaning up
Lets drop the created table on source database:
No Format | ||
---|---|---|
| ||
SQL> conn repoe/repoe@source
Connected.
SQL> drop table repoe.tables;
Table dropped. |
From the dbvrep console, you can see, that the table disappeared from the output list:
No Format | ||
---|---|---|
| ||
\ Dbvisit Replicate 2.8.04(MAX edition) - Evaluation License expires in 29 days
MINE is running. Currently at plog 33 and SCN 827460 (06/09/2017 00:34:39).
APPLY is running. Currently at plog 33 and SCN 827430 (06/09/2017 00:34:33).
Progress of replication replicate:MINE->APPLY: total/this execution
--------------------------------------------------------------------------------------------------------------------------------------------
REPOE.CARD_DETAILS: 100% Mine:1/1 Unrecov:0/0 Applied:1/1 Conflicts:0/0 Last:08/06/2017 22:04:48/OK
--------------------------------------------------------------------------------------------------------------------------------------------
1 tables listed. |
The table was dropped on source, this command was replicated to target database and finally, it was unprepared from the Replication.