home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Oracle Built-in Packages

Oracle Built-in PackagesSearch this book
Previous: 14.4 DBMS_REPCAT: Managing Snapshot Replication Groups Chapter 15 Next: 15.2 DBMS_REPCAT_ADMIN: Setting Up More Administrator Accounts
 

15. Advanced Replication

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.

DBMS_REPCAT_AUTH

Grants and revokes "surrogate SYS" privileges for an administrator account.

DBMS_REPCAT_ADMIN

Creates administrator accounts for replication.

DBMS_REPCAT

An enormous package that performs many different types of advanced replication operations. This chapter describes only the programs that deal with replication environment maintenance; the other DBMS_REPCAT programs are described in Chapter 14, Snapshots , and Chapter 16, Conflict Resolution .

DBMS_REPUTIL

Enables and disables replication at the session level.

DBMS_OFFLINE_OG

Instantiates sites -- that is, lets you export data from an existing master site and import it into the new master site.

DBMS_RECTIFIER_DIFF

Compares the replicated tables at two master sites and allows you to synchronize them if they are different.

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.

15.1 DBMS_REPCAT_AUTH: Setting Up Administrative Accounts

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.

15.1.1 Getting Started with DBMS_REPCAT_AUTH

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.

15.1.1.1 DBMS_REPCAT_AUTH programs

The DBMS_REPCAT_AUTH programs are listed in Table 15.1 .


Table 15.1: DBMS_REPCAT_AUTH Programs

Name

Description

Use in SQL?

GRANT_SURROGATE_REPCAT

Grants required privileges to a specified user

No

REVOKE_SURROGATE_REPCAT

Revokes required privileges from a specified user

No

15.1.1.2 DBMS_REPCAT_AUTH exceptions

The DBMS_REPCAT_AUTH package may raise exception ORA-01917 if the specified user does not exist.

15.1.2 Granting and Revoking Surrogate SYS Accounts

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.

15.1.2.1 The DBMS_REPCAT_AUTH.GRANT_SURROGATE_REPCAT procedure

The GRANT_SURROGATE_REPCAT procedure grants surrogate SYS privileges to a particular user. The specification is,

PROCEDURE DBMS_REPCAT_AUTH.GRANT_SURROGATE_REPCAT
    (userid IN VARCHAR2);

where userid is the Oracle userid for whom you are granting privileges.

15.1.2.1.1 Exceptions

The GRANT_SURROGATE_REPCAT procedure may raise the exception ORA-1917 if the specified user does not exist.

15.1.2.1.2 Example

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.

15.1.2.2 The DBMS_REPCAT_AUTH.REVOKE_SURROGATE_REPCAT procedure

The REVOKE_SURROGATE_REPCAT procedure revokes the surrogate SYS privileges that have previously been granted to an end user. The specification is,

PROCEDURE DBMS_REPCAT_AUTH.REVOKE_SURROGATE_REPCAT
    (userid IN VARCHAR2);

where userid is the Oracle userid for whom you are revoking privileges.

15.1.2.2.1 Exceptions

The REVOKE_SURROGATE_REPCAT procedure may raise the exception ORA-1917 if the specified user does not exist.

15.1.2.2.2 Example

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.

15.1.3 Granting and Revoking Propagator Accounts (Oracle8)

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 ).

NOTE: We recommend using the same username as the propagator at all database sites. Also, make the account the same as the replication administrator (REPADMIN) account.


Previous: 14.4 DBMS_REPCAT: Managing Snapshot Replication Groups Oracle Built-in Packages Next: 15.2 DBMS_REPCAT_ADMIN: Setting Up More Administrator Accounts
14.4 DBMS_REPCAT: Managing Snapshot Replication Groups Book Index 15.2 DBMS_REPCAT_ADMIN: Setting Up More Administrator Accounts

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference










??????????????@Mail.ru