Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 526 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
526
Dung lượng
4,84 MB
Nội dung
OracleDistributedSystems
Oracle Distributed Systems
Charles Dye
Publisher: O'Reilly
First Edition April 1999
ISBN: 1-56592-432-0, 548 pages
This book describes how you can use multiple databases
and both Oracle8 and Oracle7 distributed system features
to best advantage. It covers design, configuration of
SQL*Net/Net8, security, and Oracle's distributed options
(advanced replication, snapshots, multi-master replication,
updateable snapshots, procedural replication, and conflict
resolution). Includes a complete API reference for built-in
packages .
1
Oracle DistributedSystems
2
Oracle DistributedSystems
Oracle DistributedSystems
Preface
Audience for This Book
About Replication
About Oracle Versions and Platforms
Structure of This Book
Conventions Used in This Book
About the Scripts
Comments and Questions
Acknowledgments
I: The Distributed System
1. Introduction to Distributed Systems
1.1 Terminology and Concepts
1.2 What Is a Distributed Database System?
1.3 Benefits of Distributed Databases
1.4 Multiple Schema Versus Multiple Databases
1.5 Options for Distributed Data
1.6 Perils of Distributed Databases
1.7 Differences Between Oracle7 and Oracle8
2. SQL*Net and Net8
2.1 Protocol Overview
2.2 Architecture
2.3 SQL*Net/Net8 Tuning
2.4 Load Balancing
2.5 Oracle8 Scalability Options
2.6 SQL*Net/Net8 Client Configuration
2.7 SNMP Support
2.8 Security
3. Configuration and Administration
3.1 Initialization Parameters
3.2 Database Links
3.3 Distributed Queries and Transactions
3.4 Distributed Backup and Recovery
3.5 Multiversion Interoperability
4. Distributed Database Security
4.1 Privilege Management
4.2 Authentication Methods
5. Designing a Distributed System
5.1 Characteristics of a Distributed System
5.2 The Global Data Dictionary
5.3 Replication-Specific Issues
5.4 Data Partitioning Methodologies
5.5 Application Partitioning Strategies
5.6 Procedural Replication
3
Oracle DistributedSystems
6. Oracle's Distributed System Implementation
6.1 Meeting the 12 Objectives with Oracle
6.2 Oracle's Global Data Dictionary
7. Sample Configurations
7.1 The High-Availability System
7.2 Geographic Data Distribution
7.3 Workflow Partitioning
7.4 Data Collection and Consolidation
7.5 Loosely Coupled Federation
8. Engineering Considerations
8.1 Schema Design and Integration
8.2 Application Tiering
8.3 Designing a Replicated System
II: Replication
9. Oracle Replication Architecture
9.1 What Is Oracle Replication?
9.2 Types of Replication
9.3 Architecture Components
9.4 Replication of DDL
9.5 Oracle8 Enhancements
9.6 Oracle8i Enhancements
9.7 Alternatives to Replication
10. Advanced Replication Installation
10.1 Initialization Parameters
10.2 Redo Logs and Rollback Segments
10.3 Size and Placement of Data Dictionary Objects
10.4 Administrative Accounts, Privileges, and Database Links
11. Basic Replication
11.1 About Read-Only Snapshots
11.2 Prerequisites and Restrictions
11.3 Snapshot Creation Basics
11.4 Simple Versus Complex Snapshots
11.5 Snapshot Logs
11.6 Subquery Subsetting
11.7 Refresh Groups
11.8 Management and Optimization
11.9 Scripts
12. Multi-Master Replication
12.1 Concepts and Terminology
12.2 Getting Started
12.3 Replication Groups
12.4 Master Site Maintenance and Propagation
12.5 Controlling Propagation
12.6 The Replication Catalog
12.7 Table Replication
12.8 Replicating DDL
4
Oracle DistributedSystems
12.9 Your Replicated Environment
12.10 Advanced Replication Limitations
13. Updateable Snapshots
13.1 About Updateable Snapshots
13.2 Creating Updateable Snapshots
13.3 Communication Flow
13.4 Controlling Propagation and Refreshes
13.5 Maintenance
14. Procedural Replication
14.1 When to Use Procedural Replication
14.2 How Procedural Replication Works
14.3 Creating a Replicated Package Procedure
14.4 Restrictions on Procedural Replication
14.5 An Example
15. Conflict Avoidance and Resolution Techniques
15.1 Data Integrity Versus Data Convergence
15.2 Applications That Avoid Conflicts
15.3 Types of Conflicts Detected
15.4 How Oracle Detects and Resolves Conflicts
15.5 Column Groups and Priority Groups
15.6 The Built-in Methods
15.7 Writing Your Own Conflict Resolution Handler
III: Appendixes
A. Built-in Packages for Distributed Systems
A.1 DBMS_DEFER: Building Deferred Calls
A.2 DBMS_DEFER_QUERY: Performing Diagnostics and Maintenance
A.3 DBMS_DEFER_SYS: Managing Deferred Transactions
A.4 DBMS_OFFLINE_OG: Performing Site Instantiation
A.5 DBMS_OFFLINE_SNAPSHOT: Performing Offline Snapshot Instantiation
A.6 DBMS_RECTIFIER_DIFF: Comparing Replicated Tables
A.7 DBMS_REFRESH: Managing Snapshot Groups
A.8 DBMS_REPCAT: Performing Replication Administration
A.9 DBMS_REPCAT_ADMIN: Setting Up Administrative Accounts
A.10 DBMS_REPCAT_AUTH: Setting Up More Administrative Accounts
A.11 DBMS_REPUTIL: Enabling and Disabling Replication
A.12 DBMS_SNAPSHOT: Managing Snapshots
B. Scripts and Utilities
B.1 busycirc.sql
B.2 busydisp.sql
B.3 busyq.sql
B.4 checklatency
B.5 colgroups.sql
B.6 confstats.sql
B.7 cr_regions.sql
B.8 defcall.sql
B.9 defcalldest.sql
B.10 defcallinfo.sql
5
Oracle DistributedSystems
B.11 defdest.sql
B.12 deferror.sql
B.13 deferror8.sql
B.14 deforigin.sql
B.15 defschedule.sql
B.16 deftran.sql
B.17 deftrandest.sql
B.18 disprate.sql
B.19 errorinfo.sql
B.20 fixdefer.sql
B.21 gendelerrtran.sql
B.22 gendeltran.sql
B.23 gengensup.sql
B.24 groupedcols.sql
B.25 invalids.sql
B.26 jobs.sql
B.27 keycols.sql
B.28 lastsnap.sql
B.29 latent.sql
B.30 links.sql
B.31 mastersnapinfo.sql
B.32 mlogs.sql
B.33 needsgen.sql
B.34 nonrepobjects.sql
B.35 pk_regions.sql
B.36 prioritygroups.sql
B.37 prioritysites.sql
B.38 propmode.sql
B.39 refgroups.sql
B.40 regsnaps.sql
B.41 repcaterr.sql
B.42 repcatlog.sql
B.43 repconflict.sql
B.44 repgroup.sql
B.45 repobjects.sql
B.46 repres.sql
B.47 repsites.sql
B.48 resconfs.sql
B.49 snaps.sql
B.50 snaps7.sql
B.51 trg_regions.sql
B.52 UserAdmin
Colophon
6
Oracle DistributedSystems
Preface
In my nearly 10 years of Oracle database administration experience, I've witnessed
the emergence of a distributed database technology whose sophistication level has
risen while the average user's understanding of that technology has not. With the
advent of Oracle's advanced replication facilities, relatively few DBAs are well versed
in all aspects of Oracle's distributedsystems offerings, and few engineers fully
recognize the implications that distributedsystems have for their code. As a result,
many hours are spent struggling to implement doomed solutions, and still more
hours are spent supporting hobbled architectures.
Oracle's exploding feature set is not to blame these lost hours. There is a vast gap
between the theoretical, or academic, knowledge base surrounding distributed
systems and the practical, or applied, knowledge base. In general, the people who
understand the principles and nuances of a distributed environment are not the same
people who are out there building systems. The publications on distributedsystems
reflect this divide; most books are either very theoretical and contain little specific
advice or are rather simplistic cookbooks for those on the front lines (or in the
kitchen, as the case may be). Needless to say, it can be rather frustrating to find the
information you need when one book discusses set theory and another says "point
here, click there."
This book strives to close the gap between the theoretical and the applied by
explaining the objectives of the ideal distributed system in the context of Oracle's
technology. I examine the reasons why distributedsystems should have certain
properties and discuss how Oracle is designed to deliver these properties. I also
provide design recommendations for various common requirements. And, finally, I
deliver programming examples and scripts and tricks for the DBA. I wish I had had
this book 10 years ago.
Audience for This Book
This book is intended primarily for Oracle database administrators, developers,
system administrators, network administrators, and others who need to build or
maintain distributed database systems.
About Replication
This book contains a substantial amount of detail about Oracle's advanced replication
facilities. Most of this information has been obtained through several real-world
implementations, and my advice is based on experiences and situations that are, for
the most part, not addressed in Oracle's documentation.
In addition to sharing the benefit of my experience, this book tries to convey a
fundamental understanding of how the advanced replication facilities actually work. I
describe its underpinnings, its limitations, and how to use it successfully to solve a
variety of problems.
One thing this book does not attempt to describe is Oracle's GUI tool—Replication
Manager. Although this tool may be useful for the administration of a pre-existing,
7
Oracle DistributedSystems
stable environment, using it does not give you any insight into how replication works
or into the viability of your environment. In addition, the tool is not very useful for
solving the inevitable problems that arise in a replicated environment. If you are
interested in using Oracle's Replication Manager, we refer you to the Oracle8 Server
Replication Guide.
About Oracle Versions and Platforms
At this point, I work with Oracle8 almost exclusively in both production and
development environments. Therefore, most of the specific examples and
recommendations in this book are proven on Oracle8. In cases in which I refer to
Oracle7, I mean Version 7.3.0 and later. When I am aware of how a feature will work
under the upcoming release, Oracle8i, I have noted that as well.
As a general observation, my experience with Oracle8 has been quite positive,
especially where replication is concerned. If you have not yet migrated to Oracle8,
my advice is to do so as soon as possible.
Most of the examples described in this book were developed on a Unix operating
system; however, SQL scripts are very portable, and most of them will run as is on
Windows NT and other operating systems.
Structure of This Book
This book is divided into three parts:
Part I
Chapter 1, is an overview of distributed systems—terminology, basic concepts,
benefits and perils, and the various options provided by Oracle.
Chapter 2
, describes the underlying protocols Oracle supplies to support
communication with distributedOracle databases over a network.
Chapter 3
, explains how to set up a distributed database environment; it discusses
initialization parameters, database links, how distributed transactions work, and the
basics of distributed backup and recovery.
Chapter 4
, describes special security concerns for distributed systems; it looks at
privilege management, various authentication methods, the encryption of network
traffic, and the use of the Oracle Security Server (OSS) and the Advanced
Networking Option (ANO).
Chapter 5
, examines the design of a distributed system; it introduces C. J. Date's
fundamental principles of distributed databases, discusses the global data dictionary,
and recommends a particular approach to data partitioning.
Chapter 6
, examines how Oracle's RDBMS and networking products meet Date's
objectives for distributed database systems.
8
Oracle Distri
Indicates a tip, suggestion, or general note. For example, we'll
tell you if you need to use a particular Oracle version or if an
operation requires certain privileges.
buted Systems
9
Chapter 7, focuses on the most common distributed architectures: the high-
availability system, systems illustrating geographic data distribution, workflow
partitioning, and data collection and consolidation, and the loosely coupled federation.
Chapter 8
, examines the special requirements of distributedsystems that must be
taken into account during the engineering process: schema design and integration,
application tiering, and the design of a replicated application.
Part II
Chapter 9, takes a deeper look at Oracle's replication architecture; it examines the
various types of replication available through Oracle, specific architectural
components, installation tips, and enhancements for Oracle8 and Oracle8i.
Chapter 10
, describes how to set up an advanced replication environment, including
the setting of initialization parameters, the selection of redo logs and rollback
segments, the size and placement of data dictionary objects, and the use of
administrative accounts, privileges, and database links.
Chapter 11
, is a detailed analysis of Oracle's basic replication (snapshot) facility.
Chapter 12
, is a detailed analysis of Oracle's multi-master replication facility.
Chapter 13
, is a detailed analysis of Oracle's updateable snapshot facility.
Chapter 14
, is a detailed analysis of Oracle's procedural replication facility.
Chapter 15
, describes a variety of techniques for avoiding conflicts among the
various distributed sites where data is replicated.
Part III
Appendix A, is the Application Programming Interface (API) reference; it contains
summaries of all specifications, parameters, exceptions, and restrictions for the
procedures and functions available through the Oracle built-in packages used with
distributed systems.
Appendix B
, contains the code for a variety of scripts mentioned in this book.
Conventions Used in This Book
Indicates a warning or caution. For example, we'll tell you if
Oracle does not behave as you'd expect or if a particular
operation has a negative impact on performance.
Oracle DistributedSystems
Italic
Used for script names, filenames, directory names, and operating system
commands. Also used for replaceables in text, for emphasis, and to introduce
new terms.
Constant width
Used for code examples.
Constant width italic
Used in code examples to indicate elements (e.g., filenames) that you supply.
Constant width bold
Used occasionally to highlight particular items in code being discussed.
UPPERCASE
In code examples, generally indicates Oracle keywords.
lowercase
In code examples, generally indicates user-defined items such as variables,
parameters, and so forth.
punctuation
In code examples, enter exactly as shown.
* and */
In code examples, these characters delimit a comment, which can extend
from one line to another.
/ or #
In code examples, these characters indicate the start of a comment line.
[ ]
In syntax descriptions, square brackets enclose optional items.
{}
In syntax descriptions, curly brackets enclose a set of items; you must choose
only one of them.
10
[...]... Chapter 8, examines the special requirements of distributedsystems that must be taken into account during the engineering process: schema design and integration, application tiering, and the design of a replicated application 13 OracleDistributedSystems 14 OracleDistributedSystems Chapter 1 Introduction to DistributedSystems Any organization that uses the Oracle relational database management system... in Oracle8 , which means that they are compiled C code as opposed to PL/SQL The enhancement results in improved performance and easier maintenance 33 OracleDistributedSystems 34 OracleDistributedSystems Chapter 2 SQL*Net and Net8 SQL*Net and Net8 are the network protocols Oracle supplies to support communication with an Oracle database over a network Net8 is the new moniker for SQL*Net which Oracle. .. design of these systems It contains the following chapters: • • • • • • • • Chapter 1, is an overview of distributedsystems terminology, basic concepts, benefits and perils, and the various options provided by Oracle Chapter 2, describes the underlying protocols Oracle supplies to support communication with distributedOracle databases over a network Chapter 3, explains how to set up a distributed database... one example of how the technique could be implemented; the details come later Snapshots use the Oracle built-in package DBMS_JOB to schedule refreshes and require the INIT.ORA parameter JOB_QUEUE_PROCESSES to be greater than zero 25 OracleDistributedSystems Figure 1.6 Read-only snapshot The benefit of read-only snapshots over database links and public synonyms is that the snapshot is available even... sites impact performance Oracle has taken great steps to minimize the impact of data distribution, but it still is a factor to consider 1.7 Differences Between Oracle7 and Oracle8 Oracle has added a wide variety of capabilities into the Oracle8 server Some of the more significant enhancements relevant to distributed databases are highlighted here Global users and global roles Oracle8 provides a user... are, you will not ever need to push Oracle replication as far as Dan and Jon have Finally, I thank my wife, Kathy, who has been incredibly patient and understanding throughout the course of my writing this book Nobody is looking forward to its completion more than she is 12 OracleDistributedSystems Part I: The Distributed System Part I introduces distributed database systems and provides information... (OLTP) system 15 Oracle Distributed Systems Decentralized data Data may be updated in several databases Maintenance There must be support for activities such as load testing with data from production in a benchmarking database Oracle Corporation introduced interdatabase connectivity with SQL*Net in Oracle Version 5 and simplified its usage considerably with the database links feature in Oracle Version... complicated or long-running queries into several independent queries and allocate separate processes to execute the smaller queries A coordinator process collects the results of the smaller queries and constructs the final result set Parallel queries are effective only on machines that have multiple CPUs Parallel DML 18 Oracle Distributed Systems Oracle introduced the parallel DML feature in Oracle8 Parallel... servers, typically are high-capacity machines that run intensive utilities such as web applications, Oracle' s application cartridges, report generators, and so forth The clients in this environment are typically PCs or Macintoshes or other lightweight computers running web browsers The client's role is to provide an interface to the 19 Oracle Distributed Systems user, such as Forms (in Oracle Developer 2000)... links, how distributed transactions work, and the basics of distributed backup and recovery Chapter 4, describes special security concerns for distributed systems; it looks at privilege management, various authentication methods, the encryption of network traffic, and the use of the Oracle Security Server (OSS) and the Advanced Networking Option (ANO) Chapter 5, examines the design of a distributed . Oracle Distributed Systems Oracle Distributed Systems Charles Dye Publisher: O'Reilly First Edition April 1999 ISBN: 1-5 659 2-4 3 2-0 , 548 pages This. replicated application. 13 Oracle Distributed Systems 14 Oracle Distributed Systems Chapter 1. Introduction to Distributed Systems Any organization that uses the Oracle relational database management. Procedural Replication 3 Oracle Distributed Systems 6. Oracle& apos;s Distributed System Implementation 6.1 Meeting the 12 Objectives with Oracle 6.2 Oracle& apos;s Global Data Dictionary