rem -----------------------------------------------------------------------
rem Filename:   repdel.sql
rem Purpose:    Remove replication support from database
rem Date:       03-Oct-2000
rem Author:     Frank Naude, Oracle FAQ
rem -----------------------------------------------------------------------

spool repdel

connect repadmin/repadmin

REM Stop replication
execute dbms_repcat.suspend_master_activity(gname=>'MYREPGRP');

REM Delete replication groups
-- execute dbms_repcat.drop_master_repobject('SCOTT', 'EMP', 'TABLE');
execute dbms_repcat.drop_master_repgroup('MYREPGRP');
execute dbms_repcat.remove_master_databases('MYREPGRP', 'TD2.world');

REM Remove private databse links to other master databases
drop database link TD2.world;


connect sys

REM Remove the REPADMIN user
execute dbms_defer_sys.unregister_propagator(username=>'REPADMIN');
execute dbms_repcat_admin.revoke_admin_any_schema(username=>'REPADMIN');
drop user repadmin cascade;

REM Drop public database links to other master databases
drop public database link TD2.world;

spool off
