Advanced Replication

Chia sẻ: Dao Kim | Ngày: | Loại File: PDF | Số trang:342

0
61
lượt xem
13
download

Advanced Replication

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Oracle Database Advanced Replication describes the features and functionality of Advanced Replication. Specifically, Oracle Database Advanced Replication contains conceptual information about Advanced Replication, as well as information about planning your replication environment and troubleshooting replication problems. Oracle Database Advanced Replication also contains an introduction to the Replication Management tool in the Oracle Enterprise Manager Console.

Chủ đề:
Lưu

Nội dung Text: Advanced Replication

  1. Oracle® Database Advanced Replication 10g Release 1 (10.1) Part No. B10732-01 December 2003
  2. Oracle Database Advanced Replication, 10g Release 1 (10.1) Part No. B10732-01 Copyright © 1996, 2003 Oracle Corporation. All rights reserved. Primary Author: Randy Urbano Graphic Artist: Valarie Moore Contributors: Nimar Arora, Sukanya Balaraman, Ruth Baylis, Yuen Chan, Al Demers, Alan Downing, Curt Elsbernd, Yong Feng, Jairaj Galagali, Lewis Kaplan, Jonathan Klein, Anand Lakshminath, Jing Liu, Edwina Lu, Pat McElroy, Maria Pratt, Arvind Rajaram, Neeraj Shodhan, Wayne Smith, Jim Stamos, Janet Stern, Mahesh Subramaniam, Lik Wong, David Zhang The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the Programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle9i, Oracle8, SQL*Net, SQL*Plus, PL/SQL, and Oracle Store are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners.
  3. Contents Send Us Your Comments ................................................................................................................... ix Preface............................................................................................................................................................ xi 1 Introduction to Advanced Replication Overview of Replication ................................................................................................................... 1-2 Applications That Use Replication ................................................................................................. 1-3 Replication Objects, Groups, and Sites.......................................................................................... 1-4 Replication Objects ....................................................................................................................... 1-4 Replication Groups....................................................................................................................... 1-5 Replication Sites............................................................................................................................ 1-5 Types of Replication Environments ................................................................................................ 1-6 Multimaster Replication .............................................................................................................. 1-6 Materialized View Replication ................................................................................................... 1-8 Multimaster and Materialized View Hybrid Configurations .............................................. 1-13 Administration Tools for a Replication Environment............................................................... 1-15 Replication Management Tool in the Oracle Enterprise Manager Console....................... 1-15 Replication Management API................................................................................................... 1-17 Replication Catalog .................................................................................................................... 1-17 Distributed Schema Management............................................................................................ 1-17 Replication Conflicts........................................................................................................................ 1-18 Other Options for Multimaster Replication................................................................................ 1-19 Synchronous Replication........................................................................................................... 1-19 Procedural Replication............................................................................................................... 1-19 iii
  4. 2 Master Replication Concepts and Architecture Master Replication Concepts............................................................................................................ 2-2 What is Master Replication?........................................................................................................ 2-2 Why Use Multimaster Replication? ........................................................................................... 2-4 Multimaster Replication Process ................................................................................................ 2-7 Conflict Resolution Concepts.................................................................................................... 2-10 How Replication Works with Object Types and Collections ............................................... 2-12 Master Replication Architecture .................................................................................................... 2-18 Master Site Mechanisms ............................................................................................................ 2-18 Administrative Mechanisms ..................................................................................................... 2-32 Organizational Mechanisms ..................................................................................................... 2-37 Propagation Mechanism ............................................................................................................ 2-40 Performance Mechanisms.......................................................................................................... 2-47 Replication Protection Mechanisms......................................................................................... 2-52 Conflict Resolution Mechanisms .............................................................................................. 2-56 3 Materialized View Concepts and Architecture Materialized View Concepts............................................................................................................. 3-2 What is a Materialized View? ..................................................................................................... 3-2 Why Use Materialized Views?.................................................................................................... 3-3 Read-Only, Updatable, and Writeable Materialized Views ................................................... 3-5 Available Materialized Views..................................................................................................... 3-8 Required Privileges for Materialized View Operations........................................................ 3-15 Data Subsetting with Materialized Views............................................................................... 3-18 Determining the Fast Refresh Capabilities of a Materialized View .................................... 3-30 Multitier Materialized Views .................................................................................................... 3-31 How Materialized Views Work with Object Types and Collections .................................. 3-37 Materialized View Registration at a Master Site or Master Materialized View Site......... 3-49 Materialized View Architecture ..................................................................................................... 3-50 Master Site and Master Materialized View Site Mechanisms .............................................. 3-52 Materialized View Site Mechanisms........................................................................................ 3-56 Organizational Mechanisms ..................................................................................................... 3-58 Refresh Process............................................................................................................................ 3-63 iv
  5. 4 Deployment Templates Concepts and Architecture Mass Deployment Challenge ........................................................................................................... 4-2 Deployment Templates and the Mass Deployment Goal....................................................... 4-2 Oracle Deployment Templates Concepts....................................................................................... 4-3 Deployment Template Elements ................................................................................................ 4-4 Deployment Template Packaging and Instantiation............................................................. 4-10 Deployment Template Architecture.............................................................................................. 4-13 Template Definitions Stored in System Tables ...................................................................... 4-14 Packaging and Instantiation Process ....................................................................................... 4-15 After Instantiation ...................................................................................................................... 4-18 Deployment Template Design ....................................................................................................... 4-20 Column Subsetting with Deployment Templates ................................................................. 4-20 Row Subsetting ........................................................................................................................... 4-22 Data Sets....................................................................................................................................... 4-26 Additional Design Considerations........................................................................................... 4-28 Local Control of Materialized View Creation ............................................................................. 4-28 5 Conflict Resolution Concepts and Architecture Conflict Resolution Concepts........................................................................................................... 5-2 Understanding Your Data and Application Requirements.................................................... 5-2 Types of Replication Conflicts .................................................................................................... 5-3 Conflict Detection ......................................................................................................................... 5-5 Conflict Resolution ....................................................................................................................... 5-7 Techniques for Avoiding Conflicts .......................................................................................... 5-18 Conflict Resolution Architecture................................................................................................... 5-22 Support Mechanisms ................................................................................................................. 5-22 Common Update Conflict Resolution Methods..................................................................... 5-24 Additional Update Conflicts Resolution Methods ................................................................ 5-28 Uniqueness Conflicts Resolution Methods............................................................................. 5-37 Delete Conflict Resolution Methods ........................................................................................ 5-40 Send and Compare Old Values ................................................................................................ 5-40 v
  6. 6 Planning Your Replication Environment Considerations for Replicated Tables ............................................................................................. 6-2 Primary Keys ................................................................................................................................. 6-2 Foreign Keys .................................................................................................................................. 6-2 Datatype Considerations ............................................................................................................. 6-2 Row-Level Dependency Tracking .............................................................................................. 6-4 Initialization Parameters ................................................................................................................... 6-5 Master Sites and Materialized View Sites ..................................................................................... 6-8 Advantages of Master Sites ......................................................................................................... 6-8 Advantages of Materialized View Sites..................................................................................... 6-9 Preparing for Materialized Views .............................................................................................. 6-9 Creating a Materialized View Log ........................................................................................... 6-14 Creating a Materialized View Environment........................................................................... 6-16 Avoiding Problems When Adding a New Materialized View Site..................................... 6-18 Interoperability in an Advanced Replication Environment..................................................... 6-20 Guidelines for Scheduled Links .................................................................................................... 6-20 Scheduling Periodic Pushes ...................................................................................................... 6-21 Scheduling Continuous Pushes ................................................................................................ 6-22 Guidelines for Scheduled Purges of a Deferred Transaction Queue ..................................... 6-23 Scheduling Periodic Purges....................................................................................................... 6-24 Scheduling Continuous Purges ................................................................................................ 6-25 Serial and Parallel Propagation...................................................................................................... 6-26 Deployment Templates .................................................................................................................... 6-27 Preparing Materialized View Sites for Instantiation of Deployment Templates .............. 6-27 Conflict Resolution........................................................................................................................... 6-30 Security ............................................................................................................................................... 6-30 Designing for Survivability............................................................................................................ 6-31 Oracle Real Application Clusters versus Replication............................................................ 6-32 Designing a Replication Environment for Survivability....................................................... 6-33 Implementing a Survivable System ......................................................................................... 6-34 7 Introduction to the Replication Management Tool Usage Scenarios for the Replication Management Tool.............................................................. 7-2 Logging into the Replication Management Tool .......................................................................... 7-3 vi
  7. The Replication Management Tool Interface................................................................................ 7-4 Navigator Pane ............................................................................................................................. 7-5 Right Pane...................................................................................................................................... 7-9 The Replication Management Tool Wizards ............................................................................... 7-15 Setup Wizard............................................................................................................................... 7-15 Materialized View Group Wizard............................................................................................ 7-18 Deployment Template Wizard ................................................................................................. 7-20 Template Script Generation Wizard ........................................................................................ 7-22 Copy Template Wizard.............................................................................................................. 7-24 Flowchart for Creating a Replication Environment................................................................... 7-26 A Troubleshooting Replication Problems Diagnosing Problems with Database Links.................................................................................. A-2 Diagnosing Problems with Master Sites........................................................................................ A-2 Replicated Objects Not Created at New Master Site............................................................... A-3 DDL Changes Not Propagated to Master Site.......................................................................... A-3 DML Changes Not Asynchronously Propagated to Other Sites ........................................... A-4 DML Cannot be Applied to Replicated Table .......................................................................... A-4 Bulk Updates and Constraint Violations .................................................................................. A-4 Re-creating a Replicated Object.................................................................................................. A-5 Unable to Generate Replication Support for a Table............................................................... A-5 Problems with Replicated Procedures or Triggers .................................................................. A-5 Diagnosing Problems with the Deferred Transaction Queue.................................................... A-6 Check Jobs for Scheduled Links ................................................................................................. A-6 Distributed Transaction Problems with Synchronous Replication ....................................... A-6 Incomplete Database Link Specifications.................................................................................. A-6 Incorrect Replication Catalog Views ......................................................................................... A-7 Diagnosing Problems with Materialized Views........................................................................... A-7 Problems Creating Replicated Objects at Materialized View Site......................................... A-7 Problems Performing Offline Instantiation of a Deployment Template .............................. A-8 Refresh Problems .......................................................................................................................... A-8 Advanced Troubleshooting of Refresh Problems.................................................................. A-10 vii
  8. B Column Length Semantics and Unicode Column Length Semantics for Replication Sites and Table Columns ..................................... B-2 Multimaster Support for Column Length Semantics .................................................................. B-3 Column Length Semantics Support for Tables Generated by Advanced Replication ....... B-3 Column Length Semantics Support for Precreated Tables..................................................... B-4 Materialized View Support for Column Length Semantics ....................................................... B-5 Materialized Views with Prebuilt Container Tables ............................................................... B-5 Column Length Semantics Support for Updatable Materialized Views .............................. B-6 DDL Propagation and Column Length Semantics....................................................................... B-7 Replication Support for Unicode..................................................................................................... B-7 Replication of NCLOB Datatype Columns ............................................................................... B-9 Index viii
  9. Send Us Your Comments Oracle Database Advanced Replication, 10g Release 1 (10.1) Part No. B10732-01 Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this document. Your input is an important part of the information used for revision. I Did you find any errors? I Is the information clearly presented? I Do you need more information? If so, where? I Are the examples correct? Do you need more examples? I What features did you like most? If you find any errors or have any other suggestions for improvement, please indicate the document title and part number, and the chapter, section, and page number (if available). You can send com- ments to us in the following ways: I Electronic mail: infodev_us@oracle.com I FAX: (650) 506-7227 Attn: Server Technologies Documentation Manager I Postal service: Oracle Corporation Server Technologies Documentation 500 Oracle Parkway, Mailstop 4op11 Redwood Shores, CA 94065 USA If you would like a reply, please give your name, address, telephone number, and (optionally) elec- tronic mail address. If you have problems with the software, please contact your local Oracle Support Services. ix
  10. x
  11. Preface Oracle Database Advanced Replication describes the features and functionality of Advanced Replication. Specifically, Oracle Database Advanced Replication contains conceptual information about Advanced Replication, as well as information about planning your replication environment and troubleshooting replication problems. Oracle Database Advanced Replication also contains an introduction to the Replication Management tool in the Oracle Enterprise Manager Console. This preface contains these topics: I Audience I Organization I Related Documentation I Conventions I Documentation Accessibility xi
  12. Audience Oracle Database Advanced Replication is intended for database administrators and application developers who develop and maintain replication environments. These administrators and application developers perform one or more of the following tasks: I Plan for a replication environment I Configure the following types of replication environments: – Read-only materialized view – Updatable materialized view – Single master replication – Multimaster replication I Use deployment templates to create a materialized view environment I Configure conflict resolution I Administer a replication environment I Perform troubleshooting activities when necessary I Manage job queues I Manage deferred transactions I Use the Replication Management tool in the Oracle Enterprise Manager Console to create, monitor, and manage replication environments To use this document, you need to be familiar with relational database concepts, distributed database administration, PL/SQL (if using procedural replication), and the operating system under which you run an Advanced Replication environment. xii
  13. Organization This document contains: Chapter 1, "Introduction to Advanced Replication" Introduces the concepts and terminology of Advanced Replication. Chapter 2, "Master Replication Concepts and Architecture" Describes the concepts and architecture of multimaster replication. Chapter 3, "Materialized View Concepts and Architecture" Describes the concepts and architecture of materialized view replication. This chapter also discusses the prerequisites of building a materialized view environment. Chapter 4, "Deployment Templates Concepts and Architecture" Describes the concepts and architecture of deployment templates. This chapter also discusses designing deployment templates. Chapter 5, "Conflict Resolution Concepts and Architecture" Describes the concepts and architecture of conflict resolution. This chapter describes conflict resolution methods. Chapter 6, "Planning Your Replication Environment" Describes planning your replication environment, including information about setting initialization parameters and preparing your environment for replication. Chapter 7, "Introduction to the Replication Management Tool" Introduces you to the features of Oracle Replication Manager, a Java-based tool for creating, administering, and monitoring a replication environment. Appendix A, "Troubleshooting Replication Problems" Describes diagnosing and solving common replication problems. Appendix B, "Column Length Semantics and Unicode" Contains information about replication support for column length semantics and Unicode. xiii
  14. Related Documentation For more information, see these Oracle resources: I Oracle Database Advanced Replication Management API Reference I The Replication Management tool online help I Oracle Database Concepts I Oracle Database Administrator's Guide I Oracle Database SQL Reference I PL/SQL User's Guide and Reference (if you plan to use procedural replication) I Oracle Streams Replication Administrator's Guide if you want to migrate your Advanced Replication environment to Oracle Streams I Oracle Database New Features for information about the types of Advanced Replication environments that are supported by different editions of Oracle You may find more information about a particular topic in the other documents in the Oracle documentation set. Oracle error message documentation is only available in HTML. If you only have access to the Oracle Documentation CD, you can browse the error messages by range. Once you find the specific range, use your browser's "find in page" feature to locate the specific message. When connected to the Internet, you can search for a specific error message using the error message search feature of the Oracle online documentation. Many of the examples in this book use the sample schemas of the seed database, which is installed by default when you install Oracle. Refer to Oracle Database Sample Schemas for information on how these schemas were created and how you can use them yourself. Printed documentation is available for sale in the Oracle Store at http://oraclestore.oracle.com/ To download free release notes, installation documentation, white papers, or other collateral, please visit the Oracle Technology Network (OTN). You must register online before using OTN; registration is free and can be done at http://otn.oracle.com/membership/ xiv
  15. If you already have a username and password for OTN, then you can go directly to the documentation section of the OTN Web site at http://otn.oracle.com/documentation/ Conventions This section describes the conventions used in the text and code examples of this documentation set. It describes: I Conventions in Text I Conventions in Code Examples Conventions in Text We use various conventions in text to help you more quickly identify special terms. The following table describes those conventions and provides examples of their use. Convention Meaning Example Bold Bold typeface indicates terms that are When you specify this clause, you create an defined in the text or terms that appear in index-organized table. a glossary, or both. Italics Italic typeface indicates book titles or Oracle Database Concepts emphasis. Ensure that the recovery catalog and target database do not reside on the same disk. UPPERCASE Uppercase monospace typeface indicates You can specify this clause only for a NUMBER monospace elements supplied by the system. Such column. (fixed-width) elements include parameters, privileges, You can back up the database by using the font datatypes, RMAN keywords, SQL BACKUP command. keywords, SQL*Plus or utility commands, packages and methods, as well as Query the TABLE_NAME column in the USER_ system-supplied column names, database TABLES data dictionary view. objects and structures, usernames, and Use the DBMS_STATS.GENERATE_STATS roles. procedure. xv
  16. Convention Meaning Example lowercase Lowercase monospace typeface indicates Enter sqlplus to open SQL*Plus. monospace executables, filenames, directory names, The password is specified in the orapwd file. (fixed-width) and sample user-supplied elements. Such font elements include computer and database Back up the datafiles and control files in the names, net service names, and connect /disk1/oracle/dbs directory. identifiers, as well as user-supplied The department_id, department_name, database objects and structures, column and location_id columns are in the names, packages and classes, usernames hr.departments table. and roles, program units, and parameter values. Set the QUERY_REWRITE_ENABLED initialization parameter to true. Note: Some programmatic elements use a mixture of UPPERCASE and lowercase. Connect as oe user. Enter these elements as shown. The JRepUtil class implements these methods. lowercase Lowercase italic monospace font You can specify the parallel_clause. italic represents placeholders or variables. Run Uold_release.SQL where old_ monospace release refers to the release you installed (fixed-width) prior to upgrading. font Conventions in Code Examples Code examples illustrate SQL, PL/SQL, SQL*Plus, or other command-line statements. They are displayed in a monospace (fixed-width) font and separated from normal text as shown in this example: SELECT username FROM dba_users WHERE username = 'MIGRATE'; The following table describes typographic conventions used in code examples and provides examples of their use. Convention Meaning Example [ ] Brackets enclose one or more optional DECIMAL (digits [ , precision ]) items. Do not enter the brackets. { } Braces enclose two or more items, one of {ENABLE | DISABLE} which is required. Do not enter the braces. | A vertical bar represents a choice of two {ENABLE | DISABLE} or more options within brackets or braces. [COMPRESS | NOCOMPRESS] Enter one of the options. Do not enter the vertical bar. xvi
  17. Convention Meaning Example ... Horizontal ellipsis points indicate either: I That we have omitted parts of the CREATE TABLE ... AS subquery; code that are not directly related to the example SELECT col1, col2, ... , coln FROM employees; I That you can repeat a portion of the code . Vertical ellipsis points indicate that we SQL> SELECT NAME FROM V$DATAFILE; . have omitted several lines of code not NAME . directly related to the example. ------------------------------------ /fsl/dbs/tbs_01.dbf /fs1/dbs/tbs_02.dbf . . . /fsl/dbs/tbs_09.dbf 9 rows selected. Other notation You must enter symbols other than acctbal NUMBER(11,2); brackets, braces, vertical bars, and ellipsis acct CONSTANT NUMBER(4) := 3; points as shown. Italics Italicized text indicates placeholders or CONNECT SYSTEM/system_password variables for which you must supply DB_NAME = database_name particular values. UPPERCASE Uppercase typeface indicates elements SELECT last_name, employee_id FROM supplied by the system. We show these employees; terms in uppercase in order to distinguish SELECT * FROM USER_TABLES; them from terms you define. Unless terms DROP TABLE hr.employees; appear in brackets, enter them in the order and with the spelling shown. However, because these terms are not case sensitive, you can enter them in lowercase. lowercase Lowercase typeface indicates SELECT last_name, employee_id FROM programmatic elements that you supply. employees; For example, lowercase indicates names sqlplus hr/hr of tables, columns, or files. CREATE USER mjones IDENTIFIED BY ty3MU9; Note: Some programmatic elements use a mixture of UPPERCASE and lowercase. Enter these elements as shown. xvii
  18. Documentation Accessibility Our goal is to make Oracle products, services, and supporting documentation accessible, with good usability, to the disabled community. To that end, our documentation includes features that make information available to users of assistive technology. This documentation is available in HTML format, and contains markup to facilitate access by the disabled community. Standards will continue to evolve over time, and Oracle is actively engaged with other market-leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers. For additional information, visit the Oracle Accessibility Program Web site at http://www.oracle.com/accessibility/ Accessibility of Code Examples in Documentation JAWS, a Windows screen reader, may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, JAWS may not always read a line of text that consists solely of a bracket or brace. Accessibility of Links to External Web Sites in Documentation This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control. Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites. xviii
  19. 1 Introduction to Advanced Replication This chapter explains the basic concepts and terminology related to Advanced Replication. This chapter contains these topics: I Overview of Replication I Applications That Use Replication I Replication Objects, Groups, and Sites I Types of Replication Environments I Administration Tools for a Replication Environment I Replication Conflicts I Other Options for Multimaster Replication Note: If you are using Trusted Oracle, then see your documentation for Oracle security-related products for information about using replication in that environment. Introduction to Advanced Replication 1-1
  20. Overview of Replication Overview of Replication Replication is the process of copying and maintaining database objects, such as tables, in multiple databases that make up a distributed database system. Changes applied at one site are captured and stored locally before being forwarded and applied at each of the remote locations. Advanced Replication is a fully integrated feature of the Oracle server; it is not a separate server. Replication uses distributed database technology to share data between multiple sites, but a replicated database and a distributed database are not the same. In a distributed database, data is available at many locations, but a particular table resides at only one location. For example, the employees table resides at only the ny.world database in a distributed database system that also includes the hk.world and la.world databases. Replication means that the same data is available at multiple locations. For example, the employees table is available at ny.world, hk.world, and la.world. Some of the most common reasons for using replication are described as follows: Availability Replication provides fast, local access to shared data because it balances activity over multiple sites. Some users can access one server while other users access different servers, thereby reducing the load at all servers. Also, users can access data from the replication site that has the lowest access cost, which is typically the site that is geographically closest to them. Performance Replication provides fast, local access to shared data because it balances activity over multiple sites. Some users can access one server while other users access different servers, thereby reducing the load at all servers. Also, users can access data from the replication site that has the lowest access cost, which is typically the site that is geographically closest to them. Disconnected computing A materialized view is a complete or partial copy (replica) of a target table from a single point in time. Materialized views enable users to work on a subset of a database while disconnected from the central database server. Later, when a connection is established, users can synchronize (refresh) materialized views on demand. When users refresh materialized views, they update the central database with all of their changes, and they receive any changes that may have happened while they were disconnected. 1-2 Oracle Database Advanced Replication
Đồng bộ tài khoản