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

Oracle Built−in Packages- P152 pdf

5 93 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 91,21 KB

Nội dung

new_priority => 35); END; And, querying the DBA_REPPRIORITY data dictionary view again, we see the changed data (shown here in boldface): SQL> SELECT gname, 2 priority_group, 3 varchar2_value site_name, 4 priority 5 FROM dba_reppriority 6 WHERE priority_group = 'SP_NORTH_AMERICA' 7 ORDER BY priority; GNAME PRIORITY_GROUP SITE_NAME PRIORITY −−−−−−−− −−−−−−−−−−−−−−−−−−−− −−−−−−−−−−−−−−−−−−−− −−−−−−−− SPROCKET SP_NORTH_AMERICA D7OH.BIGWHEEL.COM 10 SPROCKET SP_NORTH_AMERICA D7HI.BIGWHEEL.COM 30SPROCKET SP_NORTH_AMERICA D7NY.BIGWHEEL.COM 35 SPROCKET SP_NORTH_AMERICA D7CA.BIGWHEEL.COM 40 This shows D7NY.BIGWHEEL.COM with its new and higher priority. 16.4.3.4 The DBMS_REPCAT.ALTER_SITE_PRIORITY_SITE The ALTER_SITE_PRIORITY_SITE procedure is analogous to the DBMS_REPCAT.ADD_PRIORITY_<datatype> procedure; use it to change the site name for an existing named site in a site priority group. The specifications for Oracle7 and Oracle8 differ as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.ALTER_SITE_PRIORITY_SITE (gname IN VARCHAR2 := '', name IN VARCHAR2, old_site IN VARCHAR2, new_site IN VARCHAR2, sname IN VARCHAR2 := ''); Here is the Oracle8 specification: PROCEDURE DBMS_REPCAT.ALTER_SITE_PRIORITY_SITE (gname IN VARCHAR2 := '', name IN VARCHAR2, old_site IN VARCHAR2, new_site IN VARCHAR2); Parameters are summarized in the following table: Name Description gname Name of the replication group to which the site priority group name belongs name Name of the site priority group old_site Global name of the site currently associated with the priority level new_site Global name of the site that is to replace old_site at old_site's priority level sname (Oracle7 only) Not used [Appendix A] What's on the Companion Disk? 16.4.3 Maintaining Site Priorities 746 16.4.3.4.1 Exceptions The ALTER_SITE_PRIORITY_SITE procedure may raise the following exceptions: Name Number Description duplicatesite −1 new_site is already in the site priority group missingpriority −1403 Site priority group name does not exist missingrepgroup −23373 Replication group gname does not exist missingvalue −23337 old_site is not in the site priority group nonmasterdef −23312 Calling site is not the master definition site 16.4.3.4.2 Restrictions Note the following restrictions on calling ALTER_SITE_PRIORITY_SITE: • You must call this procedure from the master definition site. • The new site must be unique in the site priority group. 16.4.3.4.3 Example In this example, we replace the site associated with priority level 10 with D7TX.BIGWHEEL.COM: BEGIN DBMS_REPCAT.ALTER_SITE_PRIORITY_SITE( gname => 'SPROCKET', name => 'SP_NORTH_AMERICA', old_site => 'D7OH.BIGWHEEL.COM', new_site => 'D7TX.BIGWHEEL.COM'); END; And again, we can see the change in DBA_REPPRIORITY: SQL> SELECT gname, 2 priority_group, 3 varchar2_value site_name, 4 priority 5 FROM dba_reppriority 6 WHERE priority_group = 'SP_NORTH_AMERICA' 7 ORDER BY priority; GNAME PRIORITY_GROUP SITE_NAME PRIORITY −−−−−−−− −−−−−−−−−−−−−−−−−−−− −−−−−−−−−−−−−−−−−−−− −−−−−−−− SPROCKET SP_NORTH_AMERICA D7TX.BIGWHEEL.COM 10 SPROCKET SP_NORTH_AMERICA D7HI.BIGWHEEL.COM 30 SPROCKET SP_NORTH_AMERICA D7NY.BIGWHEEL.COM 35 SPROCKET SP_NORTH_AMERICA D7CA.BIGWHEEL.COM 40 16.3 Priority Groups with DBMS_REPCAT 16.5 Assigning Resolution Methods with DBMS_REPCAT [Appendix A] What's on the Companion Disk? 16.4.3 Maintaining Site Priorities 747 Copyright (c) 2000 O'Reilly & Associates. All rights reserved. [Appendix A] What's on the Companion Disk? 16.4.3 Maintaining Site Priorities 748 Chapter 16 Conflict Resolution 16.5 Assigning Resolution Methods with DBMS_REPCAT Once you have configured your column, priority, and/or site priority groups, you can assign conflict resolution techniques to your replicated tables. 16.5.1 About Resolution Methods In addition to column groups, priority groups, and site priority groups, the advanced replication option includes eleven other built−in resolution methods to handle update and uniqueness conflicts (see Table 16.14). You can also write your own resolution handlers. In particular, if you require a delete conflict handler, you must write your own because Oracle does not supply one. Table 16.14: Built−in Conflict Resolution Methods Conflict Type Method Name Comments Update MINIMUM Data from the row having the minimum value for the designated column prevails. Data is guaranteed to converge if the value is always decreasing, or if there are fewer than three master sites. MAXIMUM Data from the row having the maximum value for the designated column prevails. Data is guaranteed to converge if the value is always increasing, or if there are fewer than three master sites. EARLIEST TIME−STAMP Data from the row having the earliest time−stamp for the designated column prevails. Data is guaranteed to converge if there are fewer than three master sites. LATEST TIME−STAMP Data from the row having the latest timestamp for the designated column prevails. Data is guaranteed to converge if the value is always increasing, or if there are fewer than three master sites. OVERWRITE Intended for a single master site with one or more updateable snapshot sites. Data from the site originating the update prevails. Convergence is not guaranteed with more than one master site. DISCARD Intended for a single master site with one or more updateable snapshot sites. Data from the site originating the update is discarded. Convergence is not guaranteed with more than one master site. ADDITIVE Intended for use with a column group con−sisting of a single numeric column. Oracle determines the new value of the 749 column by adding the difference between the old value and new value at the originating site to the current value at the destination site. Convergence is guaranteed for any number of master sites. AVERAGE Intended for a single master site with one or more updateable snapshot sites. Oracle determines the new value of the column by averaging the current value at the destination with the value from the originating site. Convergence is not guaranteed with more than one master site. Uniqueness APPEND SITE NAME Oracle resolves unique key violations (DUP_VAL_ON_INDEX) by appending the global name of the destination site (up to the first `.') to the offending column. The column must be a CHAR or VARCHAR2 type. Convergence is not guaranteed with more than one master site. APPEND SEQUENCE Oracle resolves unique key violations (DUP_VAL_ON_INDEX) by appending a generated sequence number to the offending column. The column must be a CHAR or VARCHAR2 type. Convergence is not guaranteed with more than one master site. DISCARD Oracle resolves unique key violations (DUP_VAL_ON_INDEX) by ignoring (i.e., not inserting) the new row. Convergence is not guaranteed with more than one master site. You'll use the following procedures to manipulate the conflict resolution methods associated with a given table: ADD_<conflicttype>_RESOLUTION DROP_<conflicttype>_RESOLUTION COMMENT_ON_<conflicttype>_RESOLUTION <conflicttype> can be UPDATE, UNIQUE, or DELETE. Therefore, the complete set of procedures in this category follows: ADD_UPDATE_RESOLUTION ADD_UNIQUE_RESOLUTION ADD_DELETE_RESOLUTION DROP_UPDATE_RESOLUTION DROP_UNIQUE_RESOLUTION DROP_DELETE_RESOLUTION COMMENT_ON_UPDATE_RESOLUTION COMMENT_ON_UNIQUE_RESOLUTION COMMENT_ON_DELETE_RESOLUTION 16.5.1.1 The DBMS_REPCAT.ADD_<conflicttype>_RESOLUTION The ADD_<conflicttype>_RESOLUTION procedure adds a conflict resolution type to a table. The value of <conflicttype> can be UPDATE, UNIQUE, or DELETE. Here are the specifications: PROCEDURE DBMS_REPCAT.ADD_UPDATE_RESOLUTION (sname IN VARCHAR2, [Appendix A] What's on the Companion Disk? 16.5.1 About Resolution Methods 750 . an existing named site in a site priority group. The specifications for Oracle7 and Oracle8 differ as follows. Here is the Oracle7 specification: PROCEDURE DBMS_REPCAT.ALTER_SITE_PRIORITY_SITE . particular, if you require a delete conflict handler, you must write your own because Oracle does not supply one. Table 16.14: Built−in Conflict Resolution Methods Conflict Type Method Name Comments Update. level new_site Global name of the site that is to replace old_site at old_site's priority level sname (Oracle7 only) Not used [Appendix A] What's on the Companion Disk? 16.4.3 Maintaining Site Priorities

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

TỪ KHÓA LIÊN QUAN