rem -----------------------------------------------------------------------
rem Filename:   repdef.sql
rem Purpose:    Define replication groups with replication objects
rem             Run on Master Definition site only. Run repprep.sql 
rem		on all your databases before running this script.
rem Date:       03-Oct-2000
rem Author:     Frank Naude, Oracle FAQ
rem -----------------------------------------------------------------------

set pages 50000
spool repdef

connect repadmin/repadmin

REM Create replication group for MASTERDEF site
execute dbms_repcat.create_master_repgroup('MYREPGRP');

REM Register objects within the group
execute dbms_repcat.create_master_repobject('SCOTT', -
        'EMP', 'TABLE', gname=>'MYREPGRP');

execute dbms_repcat.make_column_group(  -
        sname => 'SCOTT',               -
        oname => 'EMP',                 -
        column_group => 'EMP_COLGRP',   -
        list_of_column_names => 'EMPNO');

execute dbms_repcat.add_update_resolution( -
        sname => 'SCOTT',               -
        oname => 'EMP',                 -
        column_group => 'EMP_COLGRP',   -
        sequence_no => 1,               -
        method => 'LATEST TIMESTAMP',   -
        parameter_column_name => 'EMPNO');

REM Add master desination sites
execute dbms_repcat.add_master_database('MYREPGRP', 'TD2.world');

REM Generate replication support for objects within the group
execute dbms_repcat.generate_replication_support('SCOTT', 'EMP', 'table');

exec dbms_repcat.resume_master_activity(gname=>'MYREPGRP');
