If you are using the advanced replication option, you will use Oracle built-in packages to create and maintain a replicated environment. This chapter describes packages and the roles they play in the configuration and upkeep of a multi-master environment.
In this chapter, the presentation is more or less chronological -- the packages and their programs are presented in roughly the order in which you would run them in a real advanced replication situation.
The first step in creating an advanced replication environment is to create administrative and end user accounts. The DBMS_REPCAT_AUTH and DBMS_REPCAT_ADMIN packages contain programs that grant and revoke the privileges required in such an environment. This section describes the DBMS_REPCAT_AUTH operations; the next section describes DBMS_REPCAT_ADMIN.
The DBMS_REPCAT_AUTH package is created when the Oracle database is installed. The dbmsrepc.sql script (found in the built-in packages source directory, as described in Chapter 1, Introduction ) contains the source code for this package's specification. This script is called by catrep.sql , which must be run to install the advanced replication packages. The wrapped sql script prvtrepc.sql creates the public synonym DBMS_REPCAT_AUTH. No EXECUTE privileges are granted on DBMS_REPCAT_AUTH; only the owner (SYS) and those with the EXECUTE ANY PROCEDURE system privilege may execute the package.
The DBMS_REPCAT_AUTH programs are listed in Table 15.1 .
The DBMS_REPCAT_AUTH package contains programs that let you grant and revoke "surrogate SYS" privileges to a user. Private database links owned by SYS connect to the surrogate SYS account at remote sites, thereby avoiding the need for any database links that connect to SYS.
PROCEDURE DBMS_REPCAT_AUTH.GRANT_SURROGATE_REPCAT (userid IN VARCHAR2);
where userid is the Oracle userid for whom you are granting privileges.
The GRANT_SURROGATE_REPCAT procedure may raise the exception ORA-1917 if the specified user does not exist.
The following example illustrates how you might use GRANT_SURROGATE_REPCAT:
BEGIN DBMS_REPCAT_AUTH.GRANT_SURROGATE_REPCAT('REPSYS'); END;
This call configures the REPSYS account to perform tasks required to replicate remote DML and DDL at this site. The SYS account from remote sites should have private database links connecting to this account. The privileges granted include EXECUTE privileges on replication packages. DML privileges are data dictionary tables associated with replication.
PROCEDURE DBMS_REPCAT_AUTH.REVOKE_SURROGATE_REPCAT (userid IN VARCHAR2);
where userid is the Oracle userid for whom you are revoking privileges.
The REVOKE_SURROGATE_REPCAT procedure may raise the exception ORA-1917 if the specified user does not exist.
The following example shows how to use REVOKE_SURROGATE_REPCAT:
BEGIN DBMS_REPCAT_AUTH.REVOKE_SURROGATE_REPCAT('REPSYS'); END;
You must have only one surrogate SYS account at each site in a multimaster environment, and it is most convenient if the userid is the same at every site. Generally, the only usage of the surrogate SYS account is via a database link.
Oracle8 and Oracle7 use different mechanisms to propagate changes between sites. Oracle8 does not require a surrogate SYS account, as Oracle7 does. Instead, with Oracle8 you designate a propagator account that delivers queued transactions to remote databases and applies transactions locally on behalf of remote sites.
The programs to create and to drop propagator accounts, REGISTER_PROPAGATOR and UNREGISTER_PROPAGATOR, are contained in the DBMS_DEFER_SYS (described in Chapter 17, Deferred Transactions and Remote Procedure Calls ).
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.