Creating a Replicated Package Procedure
Creating a replicated package procedure is easy. Simply register an existing package as a replicated object with DBMS_REPCAT.CREATE_MASTER_REPOBJECT and then generate replication support for it. I recommend that you pre-create your packages in all master databases before registering them for replication.
Note
If your replicated procedure modifies a table that is undergoing row-level replication, you should disable replication within the procedure by calling DBMS_REPUTIL.REPLICATION_OFF before any SQL statements that perform DML on the table. Be sure to call DBMS_REPUTIL.REPLICATION_ON after these SQL statements.
To enable replicated calls to the package USERADMIN, we would make these DBMS_REPCAT calls:
EXECUTE dbms_repcat.create_master_repobject( - sname => 'SYSTEM', - oname => 'USER_ADMIN', - type => 'PACKAGE', - use_existing_object => TRUE, - retry => FALSE, - gname => 'RG_SPROCKET'); EXECUTE dbms_repcat.create_master_repobject( - sname => 'SYSTEM', - oname => 'USER_ADMIN', - type => 'PACKAGE BODY', - use_existing_object => TRUE, - retry => FALSE, - gname => 'RG_SPROCKET'); EXECUTE dbms_repcat.generate_replication_support( - name => 'SYSTEM', - oname => 'USER_ADMIN', - type => 'PACKAGE', - package_prefix => 'DEFER_'); EXECUTE dbms_repcat.generate_replication_support( - sname => 'SYSTEM', - oname => 'USER_ADMIN', - type => 'PACKAGE BODY', - package_prefix => 'DEFER_');
Note that we must call the CREATE_MASTER_REPOBJECT and GENERATE_REPLICATION_SUPPORT ...