23 Information Integration
001 | This chapter contains the following topics: | 本章包含以下主题: |
002 |
Introduction to Oracle Information Integration |
23.1 Oracle 信息整合特性简介 |
003 |
As a company evolves, it becomes increasingly important for it to be
able to share information among multiple databases and applications.
Companies need to share OLTP updates, database events, and application
messages, as customers place orders online, through the sales force, or
even with a partner. This information must be routed to a variety of
destinations including heterogeneous replicated databases, message
queuing systems, data warehouse staging areas, operational data stores,
other applications, and a standby database. |
随着企业的发展,在企业使用的多个数据库及应用程序间共享信息变得越来越重要。例如,当客户在线提交订单时,企业需要在各个销售团队,甚至在合作伙伴间共享
OLTP 数据更新[OLTP update],数据库事件[database event],及应用程序消息[application
message]。信息需要到达各种不同的目的地,其中包括:异构的复制数据库[heterogeneous replicated
database],消息队列系统[message queuing system],数据仓库中转区[data warehouse staging
area],操作型数据存储[operational data store],其他应用程序,或备用数据库[standby database]。 |
004 |
There are three basic approaches to sharing information. You can
consolidate the information into a single database, which eliminates the
need for further integration. You can leave information distributed, and
provide tools to federate that information, making it appear to be in a
single virtual database. Or, you can share information, which lets you
maintain the information in multiple data stores and applications. This
chapter focuses on federating and sharing information. |
共享信息有三种基本方式。第一种方式,将信息合并存储到唯一的数据库中,用户在使用数据时无需进行任何整合工作。第二种方式,分布式地存储数据,并提供用于集成[federate]信息的工具,用户在使用数据时如同访问一个虚拟的数据库。第三种方式,将信息共享[share],此时信息由各种数据存储及应用程序分别维护。本章主要讨论信息集成与信息共享。 |
005 |
|
另见: |
006 |
Oracle provides distributed SQL for federating distributed information.
Distributed SQL synchronously accesses and updates data distributed
among multiple databases, while maintaining location transparency and
data integrity. |
Oracle 使用分布式 SQL[distributed SQL]集成分布式信息。分布式 SQL
能够同步地[synchronously]访问及更新分布在多个数据库中的数据,同时确保位置透明性[location
transparency]及数据完整性[data integrity]。 |
007 |
Oracle Streams is the asynchronous information sharing infrastructure in
the Oracle database. Oracle Streams can mine the Oracle redo logs to
capture DML and DDL changes to Oracle data, and it makes that changed
data available to other applications and databases. Thus, Oracle Streams
can provide an extremely flexible asynchronous replication solution, as
well as an event notification framework. Because Streams supports
applications explicitly enqueuing and dequeuing messages, it also
provides a complete asynchronous messaging solution. That solution,
Oracle Streams Advanced Queuing, can be used to exchange information
with customers, partners, and suppliers, and to coordinate business
processes. Both Streams and distributed SQL can access and update data
in non-Oracle systems using Oracle Transparent Gateways, Generic
Connectivity, and the Messaging Gateway. Oracle can work with non-Oracle
data sources, non-Oracle message queuing systems, and non-SQL
applications, ensuring interoperability with other vendor's products and
technologies. Each of the solutions are described in detail in the
following sections. |
Oracle 数据流[Oracle Streams]是 Oracle 数据库提供的异步信息共享基础架构[asynchronous
information sharing infrastructure]。Oracle 数据流通过挖掘 Oracle 重做日志[redo
log]捕获对 Oracle 数据的 DML 及 DDL 修改操作,并可将修改的数据应用到其他应用程序或数据库。利用 Oracle
数据流能够实现灵活的异步复制方案[asynchronous replication solution],及事件通知框架[event
notification framework]。应用程序可以使用 Oracle
数据流显式地执行消息入队[enqueuing]及出队[dequeuing]操作,因此利用 Oracle
数据流还能实现异步消息方案[asynchronous messaging solution]。上述消息方案即 Oracle
数据流高级队列[Oracle Streams Advanced
Queuing],主要用于在客户,合作伙伴,及供应商间交换信息,或协同多个业务流程[business process]。Oracle
数据流及分布式 SQL 均可以通过 Oracle 透明网关[Oracle Transparent Gateway],Oracle
通用连接[Oracle Generic Connectivity],及 Oracle 消息网关[Oracle Messaging
Gateway]访问及更新存储于非 Oracle 系统中的数据。Oracle 数据库能够与非 Oracle
数据源,非 Oracle 消息队列系统,及非 SQL 应用程序相集成,这确保了 Oracle
数据库与第三方产品的互操作性[interoperability]。上述各种方案将在以下各节详细讲述。 |
008 |
A distributed environment is a network of disparate systems that
seamlessly communicate with each other. Each system in the distributed
environment is called a node. The system to which a user is directly
connected is called the local system. Any additional systems accessed by
this user are called remote systems. A distributed environment allows
applications to access and exchange data from the local and remote
systems. All the data can be simultaneously accessed and modified. |
分布式系统[distributed environment]是由多个能够无缝通信的独立系统构成的网络。分布式系统中的每个独立系统被称为节点[node]。在分布式系统中,用户直接连接的系统被称为本地系统[local
system]。而用户能够访问的其他系统被称为远程系统[remote
system]。分布式系统内的应用程序可以同时访问本地系统及远程系统,并在二者间交换信息。分布式系统内各节点的数据可以被同时地访问或修改。 |
009 |
While a distributed environment enables increased access to a large
amount of data across a network, it must also hide the location of the
data and the complexity of accessing it across the network. |
分布式系统增强了用户通过网络访问大量数据的能力,同时隐藏了数据的具体位置,降低了通过网络访问数据的复杂性。 |
010 |
In order for a company to operate successfully in a distributed
environment, it must be able to do the following:
|
布式系统必须具备以下特性才能帮助企业实现信息整合:
|
011 |
Federated Access |
23.2 统一的数据访问 |
012 |
A homogeneous distributed database system is a network of two or more
Oracle databases that reside on one or more computers. |
同构分布式数据库系统[homogeneous distributed database system]是由位于一台或多台计算机上的两个或多个
Oracle 数据库组成的网络。 |
013 |
Distributed SQL |
23.2.1 分布式 SQL |
014 |
Distributed SQL enables applications and users to simultaneously access
or modify the data in several databases as easily as they access or
modify a single database. |
应用程序或用户可以使用分布式 SQL[distributed
SQL]同时地访问或修改多个数据库中的数据,且操作上与访问或修改单一数据库中的数据一样便捷。 |
015 |
An Oracle distributed database system can be transparent to users,
making it appear as though it is a single Oracle database. Companies can
use this distributed SQL feature to make all its Oracle databases look
like one and thus reduce some of the complexity of the distributed
system. |
Oracle 分布式数据库系统[Oracle distributed database
system]对用户是透明的,在用户看来整个系统如同一个数据库。企业可以利用分布式 SQL 特性将其所使用的 Oracle
数据库整合为一个虚拟的数据库,从而降低使用分布式系统的复杂性。 |
016 |
Oracle uses database links to enable users on one database to access
objects in a remote database. A local user can access a link to a remote
database without having to be a user on the remote database. |
用户可以通过 Oracle 提供的数据库链接[database
link]访问远程数据库[remote database]中的对象。本地用户可以通过数据库链接访问远程数据库,在远程数据库中不必存在同名用户。 |
017 |
|
另见: |
018 |
Location Transparency |
23.2.2 位置透明性 |
019 |
An Oracle distributed database system lets application developers and
administrators hide the physical location of database objects from
applications and users. Location transparency exists when a user can
universally refer to a database object, such as a table, regardless of
the node to which an application connects. Location transparency has
several benefits, including the following:
|
应用程序开发者及系统管理员可以利用 Oracle 分布式数据库系统[Oracle distributed database
system]隐藏数据库对象的物理位置,使对象对应用程序及用户具有位置透明性[location
transparency]。位置透明性指无论用户连接到分布式系统内的哪个节点,都能够访问系统中任意的数据库对象(例如某个数据表)。位置透明性具有以下优势:
|
020 |
In addition to synonyms, developers can use views and stored procedures
to establish location transparency for applications that work in a
distributed database system. |
除了同义词,开发者还可以使用视图或存储过程为分布式数据库系统内的应用程序实现位置透明性。 |
021 |
|
|
022 |
SQL and COMMIT Transparency |
23.2.3 SQL 透明性与 COMMIT 透明性 |
023 |
Oracle's distributed database architecture also provides query, update,
and transaction transparency. For example, standard SQL statements such
as SELECT, INSERT,
UPDATE, and DELETE
work just as they do in a non-distributed database environment.
Additionally, applications control transactions using the standard SQL
statements COMMIT,
SAVEPOINT, and ROLLBACK. |
Oracle 的分布式数据库体系结构还提供了查询[query],更新[update],及事务[transaction
]透明性。例如,在分布式系统中执行 SELECT,INSERT,UPDATE,及 DELETE
语句的方式与在非分布式系统中完全相同。同样,在分布式系统中也使用 COMMIT,SAVEPOINT,及
ROLLBACK 等标准 SQL 语句对事务进行控制。 |
024 |
Unlike a transaction on a local database, a distributed transaction
involves altering data on multiple databases. Consequently, distributed
transaction processing is more complicated, because Oracle must
coordinate the committing or undo of the changes in a transaction as a
self-contained unit. In other words, the entire transaction commits, or
the entire transaction rolls back. |
与本地数据库[local database]内的事务不同,分布式事务有可能修改多个数据库内的数据。分布式事务的处理过程更为复杂,因为
Oracle 必须协调多个节点同时提交或同时还原事务中执行的操作。换句话说,或者整个事务被提交,或者整个事务被回滚。 |
025 |
Oracle ensures the integrity of data in a distributed transaction using
the two-phase commit mechanism. In the
prepare phase, the initiating
node in the transaction tasks the other participating nodes to promise
to commit or undo the transaction. During the
commit phase, the
initiating node asks all participating nodes to commit the transaction.
If this outcome is not possible, then all nodes undo. The two-phase
commit mechanism is completely transparent, requiring no complex
programming or other special operations to provide distributed
transaction control. |
Oracle 使用两步提交机制[two-phase commit mechanism]确保分布式事务的数据一致性[data
integrity]。在 COMMIT 的准备阶段[prepare
phase],发起事务的节点要求参与事务的其他节点确认是否能够提交事务(或需要还原事务)。在
COMMIT 的提交阶段[commit
phase],发起事务的节点要求参与事务的其他节点提交事务。如果在准备阶段某个节点的答复无法提交,则所有节点均执行还原操作。两步提交机制对用户完全透明,因此无需任何复杂编程或特殊操作就能够实现分布式事务控制。 |
026 |
|
另见: |
027 |
Distributed Query Optimization |
23.2.4 分布式查询优化 |
028 |
Distributed query optimization reduces the amount of data transfer
required between sites when a transaction retrieves data from remote
tables referenced in a distributed SQL statement. Distributed query
optimization uses Oracle's optimizer to find or generate SQL expressions
that extract only the necessary data from remote tables, process that
data at a remote site (or sometimes at the local site) and send the
results to the local site for final processing. |
当事务需要从分布式 SQL 语句[distributed SQL statement]引用的远程数据表[remote
table]获取数据时,分布式查询优化[distributed query
optimization]能够减少分布式节点间的数据传输量。分布式查询优化使用 Oracle 的优化器[optimizer]来搜索或生成 SQL
表达式[expression],并确保此表达式只从远程数据表中获取必须的数据。通常 SQL
表达式在远程节点处理数据(有时也需在本地节点处理数据),并将结果返回本地节点进行进一步处理。 |
029 |
This operation reduces the amount of required data transfer when
compared to the time it takes to transfer all the table data to the
local site for processing. Using various optimizer hints, such as
DRIVING_SITE,
NO_MERGE, and
INDEX, you can control
where Oracle processes the data and how it accesses the data. |
与将所有表数据传输回本地节点进行处理的方式相比,上述操作模式大大减少了数据传输量。通过使用不同的优化器执行指示[optimizer hint],例如
DRIVING_SITE,NO_MERGE,及 INDEX,用户可以控制
Oracle 在哪个节点处理数据及存取数据的方式。 |
030 |
|
另见: |
031 |
Information Sharing |
23.3 信息共享 |
032 |
At the heart of any integration is the sharing of data among various
applications in the enterprise. |
信息整合的核心是在企业所使用的各种应用程序间共享数据。 |
033 |
Replication is the maintenance of database objects in two or more
databases. It provides a solution to the scalability, availability, and
performance issues facing many companies. For example, replication can
improve the performance of a company's Web site. By locally replicating
remote tables that are frequently queried by local users, such as the
inventory table, the amount of data going across the network is greatly
reduced. By having local users access the local copies instead of one
central copy, the distributed database does not need to send information
across a network repeatedly, thus helping to maximize the performance of
the database application. Oracle Streams provides powerful replication
features that can be used to keep multiple copies of distributed objects
synchronized. |
数据复制[replication]是一种在两个或多个数据库间维护数据库对象的操作。复制技术是为众多面对可伸缩性[scalability],可用性[availability],及性能[performance]问题的企业提供的一种解决方案。例如,利用复制技术可以提高企业
Web 网站的性能。将本地用户访问频率高的远程数据库表复制到本地能够显著地减少通过网络传输的数据量。本地用户不必访问位于远程的集中化数据,而是访问位于本地的数据副本,此时分布式系统
内的数据库不必重复地通过网络传输信息,这有助于提升数据库应用程序的性能。Oracle
数据流[Oracle Stream]组件提供了强大的数据复制功能,可用于同步分布式数据库对象的多个副本。 |
034 |
Many companies have developed a variety of autonomous and distributed
applications to automate business processes and manage business tasks.
However, these applications need to communicate with each other,
coordinating business processes and tasks in a consistent manner. They
also need to exchange information efficiently with customers, partners,
and suppliers over low-cost channels such as the Internet, while
preserving a traceable history of events—a requirement previously
satisfied through now obsolete paper forms. For loose application
coupling, Oracle offers Oracle Streams Advanced Queuing, which is built
on top of the flexible Oracle Streams infrastructure. Oracle Streams
Advanced Queuing provides a unified framework for processing events.
Events generated in applications, in workflow, or implicitly captured
from redo logs or in database triggers can be captured and staged in a
queue. These events can be consumed in a variety of ways. They can be
applied automatically with a user-defined function or database table
operation, or they can be dequeued explicitly. Also, notifications can
be sent to the consuming application. These events can be transformed at
any stage. If the consuming application is on a different database, then
the events can be propagated to the appropriate database automatically.
Operations on these events can be automatically audited, and the history
can be retained for the user-specified duration. |
很多企业都开发了各种自治的分布式应用程序,用于业务流程[business process]的自动控制,及业务任务[business
task]的管理。这些应用程序必须能够相互通信,以便协调各自所处理的业务流程及任务,确保其处于一致性的状态。企业还需要与客户,合作伙伴,及供应商通过相对低成本的通道(例如
Internet)进行高效的信息交换,同时保留这个过程中的各种历史信息(这种过程信息以往通过纸质表单进行记录)。对于这类应用程序间的松耦合,Oracle
是通过构建在 Oracle 数据流基础架构[Oracle Streams infrastructure]上的 Oracle
数据流高级队列[Oracle Streams Advanced Queuing]实现的。Oracle
数据流高级队列是用于事件处理的统一框架。应用程序工作流[workflow]中产生的事件,可以从重做日志[redo
log]中隐式地获得,或通过触发器捕获,并暂存于队列[queue]中。使用[consume]这些事件的方法有多种,例如事件可供用户自定义函数或数据库表操作[database
table operation]自动地使用,或被显式地出队[dequeue]。应用程序还可以向需要使用事件的应用程序[consuming
application]发送通知。事件在流动的各个阶段可以被任意转换。如果需要使用事件的应用程序位于不同的数据库,事件还能被自动地传播[propagate]到相应的数据库中。针对事件的操作能够被自动地审计[audit],用户
还可以设置审计历史记录的保存周期。 |
035 |
Oracle Streams |
23.3.1 Oracle 数据流组件 |
036 |
Oracle Streams enables the propagation and management of data,
transactions, and events in a data stream either within a database, or
from one database to another. The stream routes published information to
subscribed destinations. As users' needs change, they can implement a
new capability of Oracle Streams, without sacrificing existing
capabilities. |
Oracle 数据流组件[Oracle
Streams]的功能是在一个数据库内(或多个数据库间)以数据流的形式传播数据,事务,及事件,并对此过程进行管理。数据流将数据库发布[publish]的信息传递到相应的订阅者[subscriber]处。当用户需求改变时可以订制新的数据流,而不会对已有数据流造成影响。 |
037 |
Oracle Streams provides a set of elements that allows users to control
what information is put into a stream, how the stream flows or is routed
from node to node, what happens to events in the stream as they flow
into each node, and how the stream terminates. By specifying the
configuration of the elements acting on the stream, a user can address
specific requirements, such as message queuing or data replication. |
Oracle
数据流组件提供了一组属性[element],供用户设置将何种信息加入数据流,控制数据流在节点间的流向,设定数据流内的事件进入某一节点后所触发的操作,以及数据流如何终止。通过设定数据流的各种属性,用户就可以利用数据流实现特定的需求,例如实现消息队列[message
queuing]或进行数据复制[data replication]。 |
038 |
Oracle Streams satisfies the information sharing requirements for a
variety of usage scenarios. Oracle Streams Advanced Queuing provides the
database-integrated message queuing and event management capabilities.
In addition, Oracle includes tools to help users build event
notification, replication and data warehouse loading solutions using
Oracle Streams. Using the full power of Oracle Streams, you can create
configurations that span multiple use cases, enabling new classes of
applications. Most deployments and their associated metadata are
compatible. For example, a system configured to load a data warehouse
easily can be extended to enable bi-directional replication. A complete
reconfiguration is not required. |
Oracle 数据流组件能够满足多种环境下的信息共享需求。Oracle 数据流高级队列[Oracle Streams Advanced
Queuing]提供了与数据库集成的消息队列及事件管理功能。此外,Oracle 还提供了一系列基于数据流的工具,帮助用户实现事件通知[event
notification],数据复制,及数据仓库数据加载[data warehouse loading]等解决方案。通过深入发掘 Oracle
数据流组件的功能,用户还可以创建一个框架,同时满足上述多种解决方案的需求。这些解决方案及其所需的元数据都是相互兼容的。例如,一个用于数据仓库数据加载的系统经过扩展就能被改造为一个双向数据复制[bi-directional
replication]系统,而无需重新设计系统框架。 |
039 |
|
另见: |
040 |
Oracle Streams Architecture |
23.3.1.1 Oracle 数据流体系结构 |
041 |
The architecture of Oracle Streams is very flexible. As shown in
Figure 23-1, Streams contains
three basic elements.
|
Oracle 数据流[Oracle Streams]的体系结构十分灵活。如
图 23-1 所示,数据流包含三个基本元素
|
042 |
Figure 23-1 Streams
Information Flow |
图 23-1 数据流的信息流动过程 |
043 | ||
044 |
|
图 23-1 显示了数据流的信息流动过程。第一阶段为捕获,中间为中转,最后为使用。 |
045 |
Capture |
23.3.1.1.1 捕获 |
046 |
Oracle Streams can capture events implicitly and explicitly and place
these events in a staging area. Database events, such as DML and DDL
changes, can be implicitly captured by mining the redo log files. Rules
determine what events are captured. Information representing a captured
event is formatted as a logical change record (LCR) and placed in the
staging area. |
Oracle 数据流[Oracle Streams]能够隐式地或显式地捕获事件,并将这些事件存储到中转区[staging
area]中。数据库事件(如 DML 或 DDL 语句对数据的修改)可以通过挖掘重做日志文件[redo log
file]隐式地获得。用户可以设定规则决定捕获哪些事件。数据流捕获到的事件将被格式化为逻辑修改记录[logical change
record,LCR]并存储到中转区内。 |
047 |
Oracle Streams supports mining the online redo log, as well as
mining archived log files. In the case of online redo log mining,
redo information is mined for change data at the same time it is
written, reducing the latency of capture. |
Oracle 数据流同时支持对联机重做日志[online redo log]和归档重做日志文件[archived log
file]的挖掘。在挖掘联机重做日志时,数据流获得变化数据重做信息的过程与变化数据的写入操作是同步的,这减少了被捕获信息与实际数据的延迟。 |
048 |
User applications explicitly can enqueue messages representing events
into the staging area. These messages can be formatted as LCRs, which
will allow them to be consumed by the
apply engine, or they can be
formatted for consumption by another user application using an explicit
dequeue. |
用户应用程序还可以显式地向中转区内的消息队列中加入代表数据库事件的消息。这样的消息可以被格式化为 LCR,使其能够被应用引擎[apply
engine]使用[consumption];这些消息也可以被格式化为特定的形式,经显式地出队供相应的应用程序使用。 |
049 |
Staging |
23.3.1.1.2 中转 |
050 |
Once captured, events are placed in a staging area. The staging area is
a queue that stores and manages captured events. LCRs and other types of
events are stored in a staging area until subscribers consume them.
LCR
staging provides a holding area with security, as well as auditing and
tracking of LCR data. |
事件被捕获[capture]后将被存入中转区[staging area]。中转区是一个队列[queue],用于存储及管理被捕获的事件。LCR
及其他类型的事件都被存储在中转区内,直至订阅者[subscriber]使用[consume]这些事件。LCR
中转区是一个安全的存储区,同时还能够对 LCR 数据的使用进行审计[auditing]与跟踪[tracking]。 |
051 |
Subscribers examine the contents of the staging area and determine
whether they have an interest in the message representing that event. A
subscriber can either be a user application, a propagation to another
staging area, usually on another system, or an apply process. The
subscriber optionally can evaluate a set of rules to determine whether
the message meets the criteria set forth in the subscription. If so,
then the message will be consumed by the subscriber. |
订阅者可以检查中转区内的信息,判断是否存在感兴趣的事件消息。订阅者可以是用户,应用程序,另一个中转区,或事件应用过程[apply
process],订阅者可以是事件所在节点之外的系统。订阅者可以设定一组评估规则,以决定中转区中的消息是否满足订阅条件。如满足,订阅者将使用此消息。 |
052 |
If the subscriber is a user application, then the application will
dequeue the message from the staging area in order to consume the
message. If the subscriber is a propagation to another staging area,
then the message will be propagated to that staging area. If the
subscriber is an apply process, then it will be dequeued and consumed by
the apply process. |
如果订阅者是应用程序,此程序将使中转区内的消息出队以便使用消息。如果订阅者是另一个中转区,那么消息将被传播到此中转区内。如果订阅者是事件应用过程,此过程将使中转区内的消息出队并使用消息。 |
053 |
Events in the staging area optionally may be propagated to other staging
areas in the same database, or to staging areas in remote databases. To
simplify network routing and reduce network traffic, events need not be
sent to all databases and applications. Rather, they can be directed
through staging areas on one or more systems until they reach the
subscribing system. Not all systems need subscribe to the events,
providing flexibility regarding what events are applied at a particular
system. A single staging area can stage events from multiple databases,
simplifying setup and configuration. |
一个中转区内的事件既可以被传播到同一数据库内的其他中转区,也可以被传播到远程数据库的中转区。为了简化网络传输并减少网络流量,一个事件无需发送给系统内的所有数据库及应用程序。与之相反,事件可以经过一个或多个系统的中转区到达订阅者所在的系统。Oracle
数据流不要求分布式数据库内的所有系统都订阅事件,这使各个系统可以灵活地选择其所需要的事件。同一个中转区可以中转来自多个数据库的事件,这简化了系统的搭建与配置工作。 |
054 |
As events enter the staging area, are propagated, or exit the staging
area, they can be transformed. A transformation is a change in the form
of an object participating in capture and apply or a change in the data
it holds. Transformations can include changing the datatype
representation of a particular column in a table at a particular
database, adding a column to a table at one database only, or including
a subset of the data in a table at a particular database. |
事件在进入或离开中转区时,或在传播过程中,可以同时进行转换操作。转换[transformation]指改变与被捕获或被应用事件相关的对象的定义[form],或修改对象中的数据。例如,转换包括修改数据库中某一数据表的指定列的数据类型,为某个数据库表添加列,或向某个数据库表插入一组数据。 |
055 |
Consumption |
23.3.1.1.3 使用 |
056 |
Messages in a staging area are consumed by the apply engine, where the
changes they represent are applied to a database, or they are consumed
by an application. An Oracle Streams apply process is flexible. It
enables standard or custom apply of events.
A custom apply can
manipulate the data or perform other actions during apply. Support for
explicit dequeue allows application developers to use Oracle Streams to
reliably exchange messages. They also can notify applications of changes
to data, by leveraging the change capture and propagation features of
Oracle Streams. |
中转区[staging area]内的消息可以由应用引擎[apply
engine]使用[consume],应用引擎负责执行消息所代表的数据修改;中转区内的消息也可以由应用程序使用。Oracle 数据流[Oracle
Streams]的事件应用过程[apply
process]十分灵活,其中可以采用标准或自定义的方式应用事件。在自定义的应用过程中可以操作数据或执行其他操作。Oracle
数据流支持显式出队,应用程序开发者可以利用此功能进行可靠的消息交换。开发者还可以结合使用变化数据捕捉[change data capture]及
Oracle 数据流的传播[propagation]功能将数据修改事件通知应用程序。 |
057 |
Replication with Oracle Streams |
23.3.1.2 通过 Oracle 数据流实现数据复制 |
058 |
Oracle Streams is an information sharing technology that automatically
determines what information is relevant and shares that information with
those who need it. This active sharing of information includes capturing
and managing events in the database including DML and DDL changes and
propagating those events to other databases and applications. Data
changes can be applied directly to the replica database or can call a
user-defined procedure to perform alternative work at the destination
database. For example, such a procedure can populate a staging table
used to load a data warehouse. |
Oracle 数据流[Oracle
Streams]是一种信息共享技术,此技术能够自动获取用户关心的信息,并将信息共享给有需要的用户。这个动态地信息共享过程包括捕获及管理数据库事件(例如
DML 及 DDL 语句对数据的修改),并将事件传播[propagate]到其他数据库及应用程序。Oracle
数据流捕获到的数据修改可以被直接应用到复制数据库[replica
database]中,也可在目标数据库调用自定义过程执行其他操作。例如,可以在自定义过程中将数据存入用于数据仓库数据加载的中转表[staging
table]里。 |
059 | The basic elements of the Oracle Streams technology used in replication environments include the following: | Oracle 数据流在实现数据复制时采用的基本步骤包括: |
060 |
Capturing DML and DDL Changes |
23.3.1.2.1 捕获 DML 及 DDL 对数据的修改 |
061 |
Configuring Streams for replication begins with specifying an object or
set of objects to be replicated. Using the implicit capture mechanism of
Oracle Streams, changes made to these objects can be captured
efficiently and replicated to one or more remote systems with little
impact to the originating system. This capture mechanism can extract
both data changes (DML) and structure changes (DDL) from the redo log.
The captured changes are published to a staging area. Log-based capture
leverages the fact that changes made to tables are logged in the redo
log to guarantee recoverability in the event of a malfunction or media
failure. |
在构建数据复制系统时,首先要设定需要被复制的对象或对象集。通过 Oracle 数据流[Oracle
Streams]的隐式捕获机制,对指定对象的修改能够被高效地捕获并复制到一个或多个远程数据库中,此过程对数据源系统的影响极小。Oracle
数据流的捕获机制可以从重做日志[redo
log]中抽取对数据的修改(DML)及对数据结构的修改(DDL)。被捕获的修改首先被发布到中转区[staging
area]。基于重做日志的数据修改捕获利用的是 Oracle
的重做日志功能,此功能把针对数据表的修改记录到数据库的重做日志中,以便在发生系统故障[malfunction]及介质故障[media
failure]时确保系统的可恢复性[recoverability]。 |
062 |
Capturing changes directly from the redo log minimizes the overhead on
the system. Oracle can read, analyze, and interpret redo information,
which contains information about the history of activity on a database.
Oracle Streams can mine the information and deliver change data to the
capture process. |
从重做日志中直接捕获变化信息能最小化数据源系统上的性能开销。Oracle 能够读取,分析,并解释重做信息,从中获取数据库操作的历史记录。Oracle
数据流首先挖掘出变化信息,再传递给捕获进程[capture process]。 |
063 |
Replicated databases utilizing Oracle Streams technology need not be
identical. Participating databases can maintain different data
structures using Streams to transform the data into the appropriate
format. Streams provides the ability to transform the stream at multiple
points: during change capture at the source database, while propagating
to another database, or during application at the destination site.
These transformations are user-defined functions registered within the
Oracle Streams framework. For example, the transformation can be used to
change the datatype representation of a particular column in a table or
to change the name of a column in a table or change a table name. |
利用 Oracle 数据流复制数据的目标数据库不必与源数据库完全相同。用户可以通过数据流将复制数据转换为目标数据库所需的格式。Oracle
数据流能够在数据流动的不同阶段转换[transform]数据,可以进行转换的时机包括:在源数据库捕获变化数据时,将变化数据传播到其他数据库时,或在目标节点的应用程序处理数据时。转换工作是由注册到
Oracle 数据流框架的用户自定义函数执行的。在转换中,可以修改表内某列的数据类型,也可以修改列名或表名。 |
064 |
The data at each site can be subsetted based on content as well. For
example, the replica can use a rule which specifies that only the
employees for a particular division based on the department identifier
column be contained within the table. Oracle Streams automatically
manages the changes to ensure that the data within the replica matches
the subset rule criteria. |
复制到各个节点的数据可以是源数据的子集。例如,在复制过程中可以设定规则,根据源表中的部门标识列筛选出属于特定部门的员工。Oracle
数据流能够自动地确保在复制过程中只复制符合规则的数据。 |
065 |
Propagating Changes Over a Directed Network |
23.3.1.2.2 经定向网络传播数据修改 |
066 |
Events in a staging area can be sent to staging areas in other
databases. The directed network capability of Streams allows changes to
be directed through intermediate databases as a pass-through. Changes at
any database can be published and propagated to or through other
databases anywhere on the network. By using the rules-based publish and
subscribe capabilities of the staging area queues, database
administrators can choose which changes are propagated to each
destination database and can specify the route messages traverse on
their way to a destination. |
中转区[staging area]内的事件可以被发送到其他数据库的中转区。在 Oracle 数据流[Oracle
Streams]中可以设置定向网络[directed
network],使事件按指定路径经过中间数据库到达目的地。系统内任意数据库中发生的修改都可以发布并(经过其他数据库)传播到网络内的其他数据库。Oracle
数据流的中转区队列支持基于规则的发布[publish]与订阅[subscribe],数据库管理员利用此特性可以将各种数据修改传播到相应的目标数据库,并设定消息的传播路径。 |
067 |
Thus, for example, a company could configure replication to capture all
changes to a particular schema, propagate only changes to European
customers to their European headquarters in London, apply only those
changes relevant to the London office, and forward site-specific
information to be applied at each field office. |
例如,企业可以在复制系统中捕获某一方案[schema]内的数据修改,将针对欧洲客户的修改发送到位于伦敦的欧洲总部,再将与伦敦分部有关的信息发送到伦敦分
部的系统,之后将剩余的信息继续发送到欧洲其他的分部。 |
068 |
This directed network approach is also friendly to Wide Area Networks
(WAN), enabling changes to subsequent destinations to traverse the
network once to a single site for later fan-out to other destinations,
rather than sending to each destination directly. |
定向网络方式也适合在广域网(Wide Area
Networks,WAN)中使用,消息不必直接发送到目的地,而可以首先发往一个节点,再通过网络发送到后续节点。 |
069 |
Resolving Conflicts and Applying Changes |
23.3.1.2.3 应用修改及冲突解决 |
070 |
Messages in a staging area can be consumed by an apply process, where
the changes they represent are applied to database objects, or they can
be consumed by an application. User-defined apply procedures enable
total control over the events to be applied. |
中转区[staging area]内的消息可以供应用程序使用[consume],也可供应用过程[apply
process]使用。在应用过程中,消息所代表的数据修改将被应用到目标节点的数据库对象上。用户还可以自定义应用过程,以实现对应用数据修改的完全控制。 |
071 |
Using custom apply, separate procedures can be defined for handling each
type of DML operation (inserts, updates, or deletes) on a table. For
example, using this custom apply capability, a user could write a
procedure to skip the apply of all deletes for the
employees table, for employees with a salary greater than
$100,000, based on a value for the employee in the
salary table. Inserts and updates to the
employees table would continue to be applied using the default
apply engine, as would deletes for employees with salaries less than
$100,000. |
如果采用自定义应用过程,可以定义多个过程分别处理针对表的各种 DML 操作(包括插入,更新,及删除)。例如,用户可以自定义应用过程,以
salary 表内每个员工的薪水值为依据,在对
employees 表应用删除操作时跳过薪水值超过 $100,000 的数据。而对
employees 表的插入、更新操作,以及对薪水值不超过 $100,000 的数据的删除操作则通过默认的应用引擎[apply
engine]进行应用。 |
072 |
Custom apply also could be used to perform custom transformations of
data. For example, changes to one table at the originating site might
need to be applied to three different tables at the remote location. |
用户还可以在自定义应用过程中进行数据转换。例如,对一个数据源表的修改操作可以被应用到远程位置中三个结构不同的数据表中。 |
073 |
The remote databases in a replication environment are fully open for
read/write, and need not be identical copies of the source database.
Because the remote database can be updated by other means, an apply
process detects conflicts before changes are applied. These conflicts
also can be automatically resolved using built-in or custom resolution
mechanisms. |
在一个复制系统[replication
environment]中,远程数据库是完全可读写的,且其结构不必与源数据库完全一致。由于远程数据库可能被数据流之外的其他操作修改,应用过程在应用修改前会首先进行冲突检测。被发现的冲突可以由
Oracle 内置的或用户自定义的解决机制[resolution mechanism]自动处理。 |
074 |
Oracle Streams Advanced Queuing |
23.3.1.3 Oracle 数据流高级队列 |
075 |
Beyond database integration, Oracle Streams Advanced Queuing
provides many features that make it the most robust and feature rich
message queuing system. These features improve developer
productivity and reduce the operational burden on administrators,
which reduces the cost of building and maintaining Oracle-based
distributed applications. These features are described in the
following sections. |
用户可以利用 Oracle 数据流高级队列[Oracle Streams Advanced
Queuing]组件的特性进行数据库整合,还可以构建健壮且功能丰富的消息队列系统[message queuing
system]。Oracle 数据流高级队列的特性能够大大提高开发者的生产效率,减轻管理员的负担,从而降低基于 Oracle
的消息发布应用程序[distributed application]的构建与维护成本。以下各节将介绍 Oracle
数据流高级队列的各个特性。 |
076 |
Asynchronous Application Integration |
23.3.1.3.1 异步应用整合 |
077 |
Oracle Streams Advanced Queuing provides asynchronous integration of
distributed applications. It offers several ways to enqueue messages. A
capture process can capture the messages from redo logs implicitly, or
applications and users can capture messages explicitly. Messages can be
enqueued with delay and expiration. Delay allows an enqueued message to
be visible at a later date. Advanced Queuing also supports several ways
to order messages before consumption. It supports first-in first-out
ordering and priority-based ordering of messages. Advanced Queuing also
offers multiple ways to consume a message. Automatic apply lets users
invoke a user-specified action for the message. Consuming applications
can dequeue a message explicitly. Both blocking and nonblocking dequeue
is supported. The consuming applications can choose to receive
notifications either procedurally using PL/SQL, OCI, or Java callback
functions. Alternatively, they can get notifications in an e-mail or by
HTTP post. Consuming applications can also choose to perform automatic
apply. |
Oracle 数据流高级队列组件[Oracle Streams Advanced Queuing]可以用于分布式应用程序[distributed
application]的异步整合[asynchronous
integration]。此组件提供了多种将消息入队的方式。用户或应用程序可以显式地捕获消息,也可以设置捕获进程[capture
process]隐式地从重做日志[redo
log]中获取消息。消息入队时可以设置延迟[delay]及过期[expiration]属性。延迟属性的作用是使消息在入队后经过一段延迟时间才可见。对处于队列中的消息,Oracle
数据流高级队列支持多种消息排序方式,例如先进先出排序及基于优先级的排序。Oracle
数据流高级队列还提供了多种使用[consume]消息的方式。用户可以设定相应的出队操作令消息自动(隐式)出队,也可以通过应用程序显式地令消息出队。消息出队时可以采取阻塞[blocking]及非阻塞[nonblocking]两种方式。应用程序可以
接受过程化的
PL/SQL,OCI,及 Java 回调函数或电子邮件及 HTTP 请求发出的消息通知,之后获取消息并执行应用操作。应用程序也可以自主地执行应用
操作。 |
078 |
Extensible Integration Architecture |
23.3.1.3.2 可扩展的整合体系结构 |
079 |
Oracle Streams Advanced Queuing offers an extensible framework for
developing and integrating distributed applications. Many applications
are integrated with a distributed hub and spoke model with the Oracle
database server as the hub. |
Oracle 数据流高级队列[Oracle Streams Advanced
Queuing]为分布式应用程序的开发与整合提供了一个可扩展的框架。此框架采用分布式轮辐式模型[distributed hub and
spoke model],以 Oracle 数据库服务器为中心,整合多个应用程序。 |
080 |
The distributed applications on an Oracle database communicate with
queues in the same Oracle database server hub. Oracle's extensible
framework lets multiple applications share the same queue, eliminating
the need to add additional queues to support additional applications. |
基于 Oracle 数据库的多个分布式应用程序可以与同一 Oracle 数据库服务器内的队列通信。上述多个应用程序还可以使用 Oracle
数据库内的同一个队列,而无需为每个应用程序分别创建队列。 |
081 |
Also, Advanced Queuing supports multiconsumer queues, where a single
message can be consumed by multiple applications. As additional
applications are added, these applications can coordinate business
transactions using the same queues and even the same messages in the
Oracle database server hub. It offers the benefits of extensibility
without losing guaranteed once and only once delivery of a message. |
在高级队列中,同一个队列可以有多个使用者[consumer],且同一个消息可以被多个应用程序使用。当系统整合了新应用程序时,这些新应用程序可以使用
Oracle
数据库服务器内的的同一队列,甚至队列中的同一条消息来协调各自之间的业务处理。此特性既保证了系统可扩展性,同时还能确保消息只需被传递一次。 |
082 |
Advanced Queuing supports a content-based publish and subscribe model,
where applications publish messages and consumers subscribe to the
messages without knowledge of the publishing application. With such a
model, it is possible to add consuming applications to a hub with no
change required to existing applications. |
高级队列支持基于内容的发布与订阅模式,应用程序可以发布消息,而订阅消息的应用程序无需知道此消息的发布者。在此模式下,用户可以向系统中添加新的应用程序,而不会对已有的应用程序产生影响。
|
083 |
If the distributed applications are running on different Oracle
databases, then business communications can be automatically propagated
to the appropriate Oracle database. The propagation is managed
automatically by the Oracle Streams Advanced Queuing system and is
transparent to the application. |
如果消息的使用者是运行于其他 Oracle 数据库上的分布式应用程序,高级队列能够将消息传播[propagate]到相应的 Oracle
数据库中。此传播过程由高级队列自动地管理,对应用程序透明。 |
084 |
Heterogeneous Application Integration |
23.3.1.3.3 异构应用整合 |
085 |
Traditionally, different applications had to use a common data model for
communication. This data model was further restricted by the limited
datatype support of the message-oriented middleware. Oracle Streams
Advanced Queuing supports AnyData queues that can store messages of
multiple datatypes. |
在传统的应用整合方式中,不同的应用程序必须使用相同的数据模型才能进行通信。且此数据模型还受限于基于消息的中间件所支持的数据类型。Oracle
数据流高级队列[Oracle Streams Advanced Queuing]提供了 AnyData
队列,此种队列中存储的消息可以包含多种数据类型。 |
086 |
Advanced Queuing provides applications with the full power of the Oracle
type system. It includes support for scalar datatypes such as number,
date, varchar, and so on, Oracle object types with inheritance, XMLType
with additional operators for XML data, and AnyData support. In
particular, with XMLType type support, application developers can make
use of the full power of XML for extensibility and flexibility in
business communications. |
应用程序可以通过高级队列使用 Oracle 数据类型系统[Oracle type system]的功能。Oracle
数据类型系统支持数字[number],日期[date],变长字符串[varchar]等实量[scalar]数据类型,具备继承能力的 Oracle
对象类型[object type],具有 XML 数据操作符的 XML 类型[XMLType],同时还支持 AnyData
类型。由于高级队列支持 XML 类型,应用程序开发者可以利用 XML 的可扩展性及灵活性实现不同业务间的通信。 |
087 |
Oracle Streams Advanced Queuing also offers transformation capabilities.
Applications with different data models can transform the messages while
dequeuing or enqueuing the messages to or from their own data model.
These transformation mappings are defined as SQL expressions, which can
involve PL/SQL functions, Java functions, or external C callouts. |
Oracle
数据流高级队列还提供了数据转换功能。使用不同数据模型的应用程序可以在使消息出队及入队时将其转换为自己所使用的数据模型。这些转换映射是以 SQL
表达式的形式定义的,其中可以调用 PL/SQL 函数,Java 函数,或外部 C 调用。 |
088 |
Legacy Application Integration |
23.3.1.3.4 历史遗留应用整合 |
089 |
The Oracle Messaging Gateway integrates Oracle database applications
with other message queuing systems, such as Websphere MQ (formerly
called MQ Series) and Tibco. Because many legacy applications on
mainframes communicate with Websphere MQ, there is a need for
integrating these applications into an Oracle environment. The message
gateway makes non-Oracle message queues appear as if they were Oracle
Streams queues, and automatically propagates messages between Oracle
Streams queues and Websphere MQ or Tibco queues. |
Oracle 数据库应用程序可以通过 Oracle 消息网关[Oracle Messaging Gateway]与其他消息队列系统整合,例如
Websphere MQ(以前被称为 MQ Series)及
Tibco。由于大量运行于大型机[mainframe]上的历史遗留应用[legacy application]使用 Websphere MQ
与外部通信,因此有必要将此类消息队列系统与 Oracle 系统整合。Oracle 消息网关使非 Oracle 消息队列对用户来说如同
Oracle 数据流队列一样,并可以自动在 Oracle 数据流队列与 Websphere MQ 队列或 Tibco 队列之间传播消息。 |
090 |
Distributed applications spanning multiple partners can coordinate using
the Internet access features of Oracle Streams Advanced Queuing. Using
these features, a business partner or application securely can place an
order into an advanced queuing queue over the Internet. Only authorized
and authenticated business partners can perform these operations. |
如果一个分布式应用系统包含多个外部合作伙伴的应用程序,则这些程序之间可以通过 Oracle 数据流高级队列[Oracle Streams
Advanced Queuing]的 Internet 访问能力进行通信。利用高级队列的 Internet
访问能力,外部合作伙伴或应用程序可以安全地向队列中加入订单。只有经授权且通过了身份验证的用户才有权执行此类操作。 |
091 |
Advanced Queuing Internet operations utilize an XML-based protocol over
Internet transports, such as HTTP(S), allowing messages to flow through
firewalls without compromising security. Supporting the Internet for
communications drastically reduces the cost of communications, and thus
the cost of the entire solution. |
高级队列的 Internet 访问功能使用基于 XML 的 Internet 传输层协议(例如 HTTP 或
HTTPS),消息可以通过防火墙且不会带来安全隐患。由于高级队列支持 Internet
通信,因此显著降低了通信成本,也降低了整合方案的整体成本。 |
092 |
Standard-Based API Support |
23.3.1.3.5 支持基于标准的 API |
093 |
Oracle Streams Advanced Queuing supports industry-standard APIs: SQL,
JMS, and SOAP. Database changes made using SQL are captured
automatically as messages. |
Oracle 数据流高级队列[Oracle Streams Advanced Queuing]支持业界标准的 API,包括:SQL,JMS,及
SOAP。使用 SQL 对数据库执行的修改操作可以被自动地捕获为消息。 |
094 |
Similarly, the distributed messages and database changes can be applied
to database tables, which can be seen using SQL. The messages can be
enqueued and dequeued using industry-standard JMS. Advanced queuing also
has a SOAP-based XML API and supports OCI and OCCI to enqueue and
dequeue messages. |
来自分布式系统其他节点的消息及数据库修改可以被应用到目标数据库表上,之后可以通过 SQL 进行查询。消息可以通过业界标准接口 JMS
进行入队及出队。高级队列还提供了基于 SOAP 的 XML API 及 OCI 与 OCCI,用于将消息出队与入队。 |
095 |
|
另见: |
096 |
Database Change Notification |
23.3.1.4 数据库变化通知 |
097 |
Client applications can receive notifications when the result set of a
registered query changes. For example, if the client registers a query
of the hr.employees table, and if a user
adds an employee, then the application can receive a database change
notification when a new row is added to the table. A new query of
hr.employees returns the changed result
set. Database Change Notification is relevant in many development
contexts, but is particularly useful to mid-tier applications that rely
on cached data. |
当注册查询[registered query]的结果集[result
set]发生变化时,客户端应用程序能够得到通知[notification]。例如,如果客户端注册了对 hr.employees
表的一个查询,当用户向此表中添加了新员工信息,客户端程序在新数据行被插入此表时将得到数据库变化通知[database change
notification]。此时对 hr.employees
表进行查询将得到修改后的结果集。数据库变化通知可以用于多种开发工作,尤其可用于使用缓存数据[cached data]的中间层应用系统。 |
098 |
|
另见: |
099 |
Change Data Capture |
23.3.1.5 变化数据捕捉 |
100 |
Change Data Capture, a feature built on the Oracle Streams
infrastructure, efficiently identifies and captures data that has been
added to, updated, or removed from Oracle relational tables, and it
makes the change data available for use by ETL tools and applications.
Using the Change Data Capture capabilities of Oracle Streams, it quickly
identifies and processes only the data that has changed, not entire
tables. |
变化数据捕捉[Change Data Capture,CDC]是基于 Oracle 数据流基础架构的特性,能够高效地识别及捕获 Oracle
关系数据表中被添加,更新,及删除的数据,并令变化数据可供 ETL 工具或其他应用程序使用。利用 Oracle
数据流的变化数据捕捉能力,用户可以迅速地识别及处理关系数据表中的变化数据,而无需对全部表数据进行重复处理。 |
101 |
Heterogeneous Environments |
23.3.1.6 异构系统 |
102 |
Oracle Streams is an open information sharing solution, supporting
heterogeneous replication between Oracle and non-Oracle systems. Using a
transparent gateway, DML changes initiated at Oracle databases can be
applied to non-Oracle databases. |
Oracle 数据流[Oracle Streams]是一个开放的信息共享解决方案,支持 Oracle 系统及非 Oracle
系统间的异构复制[heterogeneous replication]。通过透明网关[transparent gateway],在 Oracle
数据库中执行的 DML 操作能够被应用到非 Oracle 系统中。 |
103 |
To implement capture and apply of DML changes from an Oracle source to a
non-Oracle destination, an Oracle system functions as a proxy and runs
the apply process that would normally be running at an Oracle
destination site. The Oracle system then communicates with the
non-Oracle system with a transparent gateway. |
为了捕获 Oracle 数据源中的 DML 修改操作并应用到非 Oracle 目标系统中,可以使用一个 Oracle 系统作为代理[proxy],应用过程[apply process]通过
此代理对非 Oracle 目标系统进行应用操作,其形式与直接对
Oracle 目标系统进行应用操作相同。作为代理的 Oracle 系统通过透明网关与非 Oracle 系统进行通信。 |
104 |
The changes are dequeued in an Oracle database itself and the local
apply process applies the changes to a non-Oracle system across a
network connection through a gateway. |
数据修改首先从 Oracle 数据库中出队,之后本地的应用过程使用透明网关通过网络将数据修改应用到非 Oracle 系统。 |
105 |
Users who want to propagate changes from a non-Oracle database to an
Oracle database write an application to capture the changes made to the
non-Oracle database. The application can capture the changes by reading
from transaction logs or by using triggers. The application is then
responsible for assembling and ordering these changes into transactions,
converting them into the Oracle defined logical change record (LCR)
format, and publishing them into the target Oracle database staging
area. These changes can be applied with a Streams apply process. |
如果用户需要将非 Oracle 系统中的数据修改传播到 Oracle 数据库中,应开发应用程序捕获针对非 Oracle
数据库的修改。应用程序可以读取非 Oracle 系统的事务日志[transaction
log]或使用触发器来捕获修改。应用程序还应负责将捕获的修改操作进行排序并组合为事务,之后再转换为 Oracle
定义的逻辑修改记录[logical change record,LCR]格式,最后发布到目标 Oracle 数据库的中转区[staging
area]。此时数据流应用过程就可以应用这些数据修改。 |
106 |
|
另见: |
107 |
Oracle Streams Use Cases |
23.3.1.7 Oracle 数据流使用案例 |
108 |
Use Oracle Streams to create configurations that enable new classes of
applications. In addition, all deployments and their associated metadata
are compatible. For example, a replication installation easily can be
extended to load a data warehouse or enable bi-directional replication—a
complete reconfiguration is not required. |
利用 Oracle
数据流组件,用户可以创建一个框架,并在此框架的基础上实现多种类型的信息整合应用程序。这些应用程序及其所使用的元数据都是相互兼容的。例如,一个数据复制应用可以被扩展为数据仓库数据加载系统或双向数据复制[bi-directional
replication]系统,而无需重新设计整个框架。 |
109 |
Suppose that a company uses Oracle Streams to maintain multiple copies
of a corporate Web site for improved availability, scalability, and
performance. Additional requirements could include a reporting database
containing the most current information for analysts in a company
headquarters office in New York to perform ad-hoc querying as well as a
disaster recovery database separately maintained from their New York
office. Additionally, updatable materialized views can be used to
support the field sales staff. A final requirement is to share data with
existing applications that are hosted on a Sybase database. |
例如,一个企业使用 Oracle 数据流[Oracle Streams]来维护其 Web
站点的多个副本,以增强站点的可用性,可伸缩性,及性能。此外还需要一个报表数据库存储最新数据,供纽约总部进行即席查询[ad-hoc
querying],以及一个位于纽约总部的灾难恢复数据库。系统使用物化视图[materialized
view]为不在固定办公场所的销售人员提供数据。最后,系统还要与基于 Sybase 数据库的旧有应用共享数据。 |
110 |
Figure 23-2 illustrates this
Streams configuration. |
图 23-2 显示了这个数据流系统的架构。 |
111 |
Figure 23-2 Streams
Configuration |
图 23-2 示例数据流系统架构 |
112 | ||
113 |
|
图 23-2 将在下文中说明。 |
114 |
Oracle Streams is used to replicate data in an N-way configuration
consisting of three regional sites: New York, London, and Tokyo. At each
of these sites, Streams log-based capture collects any changes that
occur for subscribed tables in each local region, and stages them
locally in the queue. All changes captured in each region are then
forwarded to each of the other region's databases with the goal that all
changes made at each database be reflected at every other database,
providing complete data for the subscribed objects throughout the world. |
Oracle
数据流需要在这个架构内的三个节点(纽约,伦敦,和东京)之间进行双向的数据复制。在每个节点上,数据流从重做日志中捕获节点上针对被订阅数据表的数据修改,并暂存于本地队列中。之后在一个节点上被捕获的数据将被传播到其他所有节点上,
从而实现对一个数据库的修改可以反映到其他所有数据库上,此时整个系统内各个节点上的订阅对象中都拥有完整的数据。 |
115 |
Because the updates are applied automatically when received at each
regional database, an Oracle Streams apply process is used to apply the
changes. As changes are applied, Oracle Streams checks for and resolves
any conflicts that are detected. Streams also can be used to exchange
data for particular tables with non-Oracle databases. Utilizing the
Oracle Transparent Gateway for Sybase, a Streams apply process applies
the changes to a Sybase database using the same mechanisms as it does
for Oracle databases. |
每个节点使用 Oracle 数据流的应用进程[apply process]将数据修改自动地应用到节点上。数据修改被应用时,Oracle
数据流将检查并解决侦测到的冲突。Oracle 数据流能够与非 Oracle 数据库中的特定表交换数据。通过支持 Sybase 的 Oracle
透明网关[Oracle Transparent Gateway],数据流应用进程可以将数据修改应用到 Sybase 数据库,其操作方式与在
Oracle 数据库上进行数据修改应用相同。 |
116 |
The databases for reporting and disaster recovery are hosted from the
New York database site. The reporting database is a fully functional
Oracle database that has a read-only copy of the relevant application
tables. The reporting site is not configured to capture changes on these
application tables. Streams imposes no restrictions on the configuration
or usage of this reporting database. |
用于报表和灾难恢复的数据库位于纽约节点。报表数据库是一个 Oracle
数据库,其中存储了与报表相关数据表的只读副本。报表数据库不采用捕获变化数据的方式获取数据。因此报表数据的配置与使用不受数据流的限制。 |
117 |
The London site also serves as the master site for several updatable
materialized view sites. Each salesperson receives an updatable copy of
just the portion of the data that he requires. These sites typically
only connect once a day to upload their orders and download any changes
since their last refresh. |
伦敦节点具备一个特殊功能,她将作为多个可更新的物化视图节点的主节点[master
site]。每个销售人员都可以从主节点中获得其需要的部分数据的副本,并更新到本地。物化视图节点一般每天与主节点连接一次,上传本地的订单数据,并下载上次刷新后主节点中修改的数据。 |
118 |
Materialized Views |
23.3.2 物化视图 |
119 |
Oracle Streams is fully inter-operational with materialized views, or
snapshots, which can be used to maintain updatable or read-only,
point-in-time copies of data. They can be defined to contain a full copy
of a table or a defined subset of the rows in the master table that
satisfy a value-based selection criterion. There can be multitier
materialized views as well, where one materialized view is based on
another materialized view. Materialized views are periodically updated,
or refreshed, from their associated master tables through
transactionally consistent batch updates. |
物化视图[materialized view](也称为快照[snapshot])是一个可更新或只读的反映数据某一时间点状态的副本,Oracle
数据流[Oracle Streams]能够与物化视图进行完全的相互操作。物化视图可以是主表[master
table]的完整副本,也可以是基于数据值筛选出的一个结果集。物化视图的源可以是另一个物化视图,这种情况被称为多层物化视图[multitier
materialized view]。物化视图可以按周期更新,也可以基于主表上的数据修改事务实时刷新。 |
120 |
Read-only materialized views can be used to periodically propagate the
updated product catalog to the various sales offices, because the
product catalog is only updated at the headquarters location. |
例如,产品目录数据只需在总部数据库中修改,这些修改可以被周期性地更新到多个销售分部的只读物化视图中。 |
121 |
Because materialized views do not require a dedicated connection, they
are ideal for disconnected computing. For example, a company might
choose to use updatable materialized views for the members of their
sales force. A salesperson could enter orders into his or her laptop
throughout the day, then simply dial up the regional sales office at the
end of the day to upload these changes and download any updates. |
物化视图与主数据库间不需要建立持续的连接,因此物化视图适用于脱机计算[disconnected
computing]。例如,企业可以利用物化视图与销售团队的成员共享数据。销售人员可以将日间发生的订单录入到随身的笔记本电脑中,并在一天的工作结束后与销售部门的系统
联机,上传新数据并下载系统中上次刷新后的修改数据。 |
122 |
Integrating Non-Oracle Systems |
23.4 整合非 Oracle 系统 |
123 |
Oracle provides two solutions for integrating the Oracle database server
with non-Oracle databases--Generic Connectivity and Transparent
Gateways. These solutions enable Oracle clients to access non-Oracle
data stores. They translate third party SQL dialects, data dictionaries,
and datatypes into Oracle formats, thus making the non-Oracle data store
appear as a remote Oracle database. These technologies enable companies
to integrate seamlessly the different systems and provide a consolidated
view of the company as a whole. |
Oracle 为整合 Oracle 数据库服务器与非 Oracle 数据库提供了两种方案:通用连接[Generic
Connectivity]和透明网关[Transparent Gateways]。这两种方案均能使 Oracle 客户端访问非 Oracle
数据源。这两种方案能够将第三方数据源的 SQL 语法,数据字典,及数据类型转换为 Oracle 的格式,使非 Oracle 数据源如同一个远程
Oracle 数据库。企业利用这种技术可以无缝地整合异构数据库系统,获得一个全面反映企业信息的统一的数据视图。 |
124 |
Generic Connectivity and Oracle Transparent Gateways can be used for
synchronous access, using distributed SQL. In addition, Oracle
Transparent Gateways can be used for asynchronous access, using Oracle
Streams. Introducing a Transparent Gateway into an Oracle Streams
environment enables replication of data from an Oracle database to a
non-Oracle database. |
分布式 SQL[distributed SQL]可以利用通用连接或透明网关对异构数据库进行同步地访问。此外,Oracle 数据流[Oracle
Streams]可以利用透明网关对异构数据库进行异步地访问。在 Oracle 数据流系统中应用透明网关技术,就可以将 Oracle
数据库的数据复制[replication]到非 Oracle 系统中。 |
125 |
Both Generic Connectivity and Oracle Transparent Gateways transparently
access data in non-Oracle systems from an Oracle environment. As with an
Oracle distributed database environment, location transparency can be
extended to objects residing in non-Oracle systems as well. Therefore,
users can create synonyms for the objects in the non-Oracle database and
refer to them without having to specify its physical location. This
transparency eliminates the need for application developers to customize
their applications to access data from different non-Oracle systems,
thus decreasing development efforts and increasing the mobility of the
application. Instead of requiring applications to interoperate with
non-Oracle systems using their native interfaces (which can result in
intensive application-side processing), applications can be built upon a
consistent Oracle interface for both Oracle and non-Oracle systems. |
利用通用连接或透明网关,用户可以在 Oracle 系统中透明地访问非 Oracle 系统。在一个分布式 Oracle 数据库系统中,位于非
Oracle 数据库内的对象同样可以具备位置透明性[location transparency]。因此,用户可以为非 Oracle
数据库对象创建同义词,在使用此类对象时无需指明其物理位置。利用此种访问透明性,应用程序开发者无需为访问非 Oracle
数据库而开发特殊的代码,这减少了开发量且提高了应用程序的可迁移能力。应用程序在访问 Oracle 及非 Oracle 数据库时均可以使用
Oracle 数据库接口,而无需使用非 Oracle 系统的原生接口[native
interface]与其交互(这将显著地增加应用程序的数据处理工作)。 |
126 |
Generic Connectivity |
23.4.1 通用连接 |
127 |
Generic Connectivity is a generic solution that uses an ODBC or OLEDB
driver to access any ODBC or OLEDB compliant non-Oracle system. It
provides data access to many data stores for which Oracle does not have
a gateway solution. This enables transparent connectivity using industry
standards, such as ODBC and OLEDB. Generic connectivity makes it
possible to access low-end data stores, such as Foxpro, Access, dBase,
and non-relational targets like Excel. |
通用连接[Generic Connectivity]是一种通用的解决方案,使用 ODBC 或 OLEDB 驱动访问任何与 ODBC 或
OLEDB 兼容的非 Oracle 系统。利用通用连接可以访问许多 Oracle 未提供透明网关的数据源。通用连接利用业界标准(例如 ODBC
及 OLEDB)提供了透明的数据访问能力。用户利用通用连接可以实现对低端数据源的访问,例如 Foxpro,Access,dBase,及
Excel 之类的非关系型数据源。 |
128 |
Oracle Transparent Gateways |
23.4.2 Oracle 透明网关 |
129 |
In contrast to Generic Connectivity, which is a generic solution, Oracle
Transparent Gateways are tailored solutions, specifically coded for the
non-Oracle system. They provide an optimized solution, with more
functionality and better performance than Generic Connectivity. |
通用连接[Generic Connectivity]是一种通用的解决方案,而 Oracle 透明网关[Oracle Transparent
Gateways]是针对每种非 Oracle 系统特别订制的方案。与通用连接相比,透明网关提供的功能更加丰富,且性能更佳。 |
130 |
Generic Connectivity relies on industry standards, whereas Oracle
Transparent Gateways accesses the non-Oracle systems using their native
interface. The Transparent Gateways are also end-to-end certified.
Oracle has Transparent Gateways to many sources, including Sybase, DB2,
Informix, and Microsoft SQL Server. |
通用连接是基于业界标准的,而 Oracle 透明网关则使用每种非 Oracle 系统的原生接口[native interface]对其进行访问。透明网关能够确保端到端的通信。Oracle
提供了访问多种数据源的透明网关,其中包括 Sybase,DB2,Informix,及 Microsoft SQL Server。 |
131 |
|
另见: |
[003] heterogeneous replicated databases [079] distributed hub and spoke model |
[025] prepare phase [025] commit phase [029] optimizer hints [048] apply engine [075] distributed applications [085] AnyData |
[036] As users' needs change, they can
implement a new capability of Oracle Streams, without sacrificing
existing capabilities. [050] LCR staging provides a holding area with security, as well as auditing and tracking of LCR data. [056] A custom apply can manipulate the data or perform other actions during apply. [068] This directed network approach is also friendly to Wide Area Networks (WAN), enabling changes to subsequent destinations to traverse the network once to a single site for later fan-out to other destinations, rather than sending to each destination directly. [094] Similarly, the distributed messages and database changes can be applied to database tables, which can be seen using SQL. [130] The Transparent Gateways are also end-to-end certified. |
1、继续看相关文档,了解选择处理位置的规则,以及各种情况下的默认规则。 [029] Using various optimizer hints, such as DRIVING_SITE, NO_MERGE, and INDEX, you can control where Oracle processes the data and how it accesses the data. 2、不理解什么是 content-based? [082] Advanced Queuing supports a content-based publish and subscribe model, where applications publish messages and consumers subscribe to the messages without knowledge of the publishing application. With such a model, it is possible to add consuming applications to a hub with no change required to existing applications. |