1. Trang chủ
  2. » Công Nghệ Thông Tin

Oracle Built−in Packages- P131 ppsx

5 247 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 93,76 KB

Nội dung

Chapter 15 641 15. Advanced Replication Contents: DBMS_REPCAT_AUTH: Setting Up Administrative Accounts DBMS_REPCAT_ADMIN: Setting Up More Administrator Accounts DBMS_REPCAT: Replication Environment Administration DBMS_OFFLINE_OG: Performing Site Instantiation DBMS_RECTIFIER_DIFF: Comparing Replicated Tables DBMS_REPUTIL: Enabling and Disabling 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 15. Advanced Replication 642 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. [Appendix A] What's on the Companion Disk? 15.1.1 Getting Started with DBMS_REPCAT_AUTH 643 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. 14.4 DBMS_REPCAT: Managing Snapshot Replication Groups 15.2 DBMS_REPCAT_ADMIN: Setting Up More Administrator Accounts Copyright (c) 2000 O'Reilly & Associates. All rights reserved. [Appendix A] What's on the Companion Disk? 15.1.2 Granting and Revoking Surrogate SYS Accounts 644 Chapter 15 Advanced Replication 15.2 DBMS_REPCAT_ADMIN: Setting Up More Administrator Accounts Along with DBMS_REPCAT_AUTH, use the DBMS_REPCAT_ADMIN package to create administrator accounts for replication. This section explains how to do so. 15.2.1 Getting Started with DBMS_REPCAT_ADMIN The DBMS_REPCAT_ADMIN 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) 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_ADMIN. No EXECUTE privileges are granted on DBMS_REPCAT_ADMIN; only the owner (SYS) and those with the EXECUTE ANY PROCEDURE system privilege may execute the package. 15.2.1.1 DBMS_REPCAT_ADMIN programs Table 15.2 lists the programs in DBMS_REPCAT_ADMIN Table 15.2: DBMS_REPCAT_ADMIN Program Name Description Use in SQL? GRANT_ADMIN_ANY_REPGROUP Grants privileges required to administer any replication group at the current site No GRANT_ADMIN_ANY_REPSCHEMA (Oracle8) Grants privileges required to administer any replication schema at the current site No GRANT_ADMIN_REPGROUP Grants privileges required to administer the replication group for which the user is the schema owner No GRANT_ADMIN_REPSCHEMA (Oracle8) Grants privileges required to administer the replication schema for which the user is the schema owner No REVOKE_ADMIN_ANY_REPGROUP Revokes privileges required to administer all replication groups No REVOKE_ADMIN_ANY_REPSCHEMA No 645 . 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. 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,. Enabling and Disabling 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

Ngày đăng: 07/07/2014, 00:20

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN