In this post we will try to replicate a table from source database to target database on different server through OEM using streams.

source db - gclone1@ggsource.localdomain
target db - london@ggtarget.localdomain
SYS@ gclone1>select name,open_mode, host_name from v$database,v$instance;

NAME      OPEN_MODE            HOST_NAME
--------- -------------------- --------------------
GCLONE1   READ WRITE           ggsource.localdomain

SYS@ gclone1>select * from scott.src_tab;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30

12 rows selected.

Go to the source database and select option to setup streams


Login to source database using sys credentials


You will receive a warning message that SYS – Is not in the Streams Administrator group and may not have full privileges to set up successful replication. So you need to ensure that a streams user is created before you proceed further.

Click on highlighted option

Enter details of your choice and click ok.

Once this user is created login through this user and select option to setup streams

Select “Replicate table” option and verify host credentials are selected . click on continue

Now add table you want to replicate

I am replicating SCOTT.SRC_TAB

Enter destination database details

I am using london@ggtarget.localdomain. Ensure that you have stream user present in target database as well. If it is not there create as per process defined in post above.

Here I am going with the default settings. No changes on step 3.

Select immediate option

Verify details and submit if all looks good

Click ok

Click show job

You can view the progress of job

Make sure your job status is succeeded

Verify there are no error messages in target database

col APPLY_NAME for a20
col RULE_SET_NAME for a20
col NEGATIVE_RULE_SET_NAME for a20
SELECT APPLY_NAME,QUEUE_NAME,RULE_SET_NAME,NEGATIVE_RULE_SET_NAME,STATUS FROM DBA_APPLY;

APPLY_NAME           QUEUE_NAME           RULE_SET_NAME        NEGATIVE_RULE_SET_NA STATUS
-------------------- -------------------- -------------------- -------------------- --------
APPLY$_GCLONE1_3     GCLONE1$APPQ         RULESET$_4                                ENABLED

We can verify if our table got created in target database. Note that we didn’t have this table present in target database before we started the replication. We can see that table is created.

SYS@ london>select name,open_mode, host_name from v$database,v$instance;

NAME      OPEN_MODE            HOST_NAME
--------- -------------------- ----------------------------------------------------------------
LONDON    READ WRITE           ggtarget.localdomain

SYS@ london>select owner,object_name,object_type,to_char(created,'dd-mm-yy hh24:mi:ss') from dba_objects where object_name='SRC_TAB';

OWNER      OBJECT_NAM OBJECT_TYPE             TO_CHAR(CREATED,'
---------- ---------- ----------------------- -----------------
SCOTT      SRC_TAB    TABLE                   07-04-20 15:07:43

SYS@ london>select * from scott.src_tab;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30

12 rows selected.

Now lets verify if any changes in source table is propagating properly to target table.

We can see the deleted row from source reflected in target table as well.