001 |
This chapter defines application architecture and describes how the
Oracle database server and database applications work in a distributed
processing environment. This material applies to almost every type of
Oracle database system environment.
|
本章讲述 Oracle 系统的应用体系结构,及 Oracle 数据库服务器与应用程序如何在分布式环境下工作。本章内容基本上覆盖了所有类型的
Oracle 数据库系统的结构。
|
002 |
This chapter contains the following topics:
|
本章包含以下主题:
|
003 |
Introduction to
Client/Server Architecture
|
10.1 客户端/服务器体系结构简介
|
004 |
In the Oracle database system environment, the database application and
the database are separated into two parts: a front-end or client
portion, and a back-end or server portion—hence the term
client/server architecture. The client runs the database application
that accesses database information and interacts with a user through the
keyboard, screen, and pointing device, such as a mouse. The server runs
the Oracle software and handles the functions required for concurrent,
shared data access to an Oracle database.
|
在一个 Oracle 数据库系统中,数据库应用程序与数据库被分为两部分:前端(front-end)或称为客户端(client);后台(back-end)或称为服务端(server)——这就是客户端/服务器体系结构(client/server architecture)名字的由来。客户端运行数据库应用程序,此程序能够从数据库获取数据,并通过键盘,鼠标,显示器之类的设备和用户交互。服务端运行
Oracle 数据库程序,这些程序能实现多用户并发、共享地访问数据库。
|
005 |
Although the client application and Oracle can be run on the same
computer, greater efficiency can often be achieved when the client
portions and server portion are run by different computers connected
through a network. The following sections discuss possible variations in
the Oracle client/server architecture.
|
客户端应用与 Oracle
数据库也可以运行在同一计算机上,但是这两者如果能运行在通过网络连接在一起的不同计算机上,整个系统的效率将会得到提高。以下段落将讨论客户端/服务器体系结构
的两种变形。
|
006 |
Distributed processing is the use of more than one processor,
located in different systems, to perform the processing for an
individual task. Examples of distributed processing in Oracle database
systems appear in Figure 10-1.
- In Part A of the figure, the client
and server are located on different computers, and these computers
are connected through a network. The server and clients of an Oracle
database system communicate through Oracle Net Services, Oracle's
network interface.
- In Part B of the figure, a single
computer has more than one processor, and different processors
separate the execution of the client application from Oracle.
|
分布式处理(distributed processing)是指利用位于不同系统的多个处理器来处理一个单一任务。Oracle
数据库系统中存在的分布式处理如 图10-1 所示。
-
在此图的第一部分中,客户端与服务器位于不同的计算机上,这些计算机通过网络相连。数据库系统中的客户端与服务器通过 Oracle
的网络接口——Oracle 网络服务(Oracle Net Services)进行通信。
- 在此图的第二部分中,一个计算机拥有多个处理器,Oracle
服务器和客户端应用程序可以在不同的处理器上运行。
|
007 |
Note:
This chapter applies to environments with one database on one
server. In a distributed database, one server (Oracle) may
need to access a database on another server.
|
提示:
本章主要讨论只包含一个 Oracle 数据库的系统。而在分布式数据库系统(distributed database)中,
一个 Oracle 数据库服务器可能还需要访问其他 Oracle 数据库服务器。
|
008 |
Figure 10-1 The
Client/Server Architecture and Distributed Processing
|
图10-1 客户端/服务器体系结构及分布式处理
|
009 |
|
|
010 |
Oracle client/server architecture in a distributed processing
environment provides the following benefits:
- Client applications are not
responsible for performing any data processing. Rather, they request
input from users, request data from the server, and then analyze and
present this data using the display capabilities of the client
workstation or the terminal (for example, using graphics or
spreadsheets).
- Client applications are not dependent
on the physical location of the data. Even if the data is moved or
distributed to other database servers, the application continues to
function with little or no modification.
- Oracle exploits the multitasking and
shared-memory facilities of its underlying operating system. As a
result, it delivers the highest possible degree of concurrency, data
integrity, and performance to its client applications.
- Client workstations or terminals can
be optimized for the presentation of data (for example, by providing
graphics and mouse support), and the server can be optimized for the
processing and storage of data (for example, by having large amounts
of memory and disk space).
- In networked environments, you can use
inexpensive client workstations to access the remote data of the
server effectively.
- If necessary, Oracle can be scaled
as your system grows. You can add multiple servers to distribute the
database processing load throughout the network (horizontally
scaled), or you can move Oracle to a minicomputer or mainframe,
to take advantage of a larger system's performance (vertically
scaled). In either case, all data and applications are
maintained with little or no modification, because Oracle is
portable between systems.
- In networked environments, shared data
is stored on the servers rather than on all computers in the system.
This makes it easier and more efficient to manage concurrent access.
- In networked environments, client
applications submit database requests to the server using SQL
statements. After it is received, the SQL statement is processed by
the server, and the results are returned to the client application.
Network traffic is kept to a minimum, because only the requests and
the results are shipped over the network.
|
采用分布式处理的客户端/服务器体系结构具有以下优势:
-
客户端应用程序无需进行数据处理工作。客户端的职责是处理用户的输入,向服务器请求数据,最后利用客户端工作站(workstation)或终端(terminal)的显示能力分析展现数据。(例如通过图形或电子表格展现并分析数据)
-
客户端应用程序与数据存储的耦合度很低。即便数据被移动到另一个数据库,应用程序需要很少(或不需要)改动就能继续正常工作。
- Oracle
系统能利用其所在操作系统的多任务(multitasking)功能及共享内存(shared-memory )功能。因此,Oracle
能为客户端应用提供最好的并发访问能力,数据完整性控制,及系统性能。
-
客户端工作站或终端可以专为展现数据而优化(例如具备图形处理能力及鼠标设备),而数据库服务器可以专为存储及处理数据而优化(例如具备大量的内存与磁盘空间)。
- 在网络环境中,用户可以使用较廉价的客户端工作站来访问位于远程数据库上的数据。
- 在需要时,Oracle 系统具备伸缩(scaled)能力。用户可以添加服务器,使数据处理的工作负载通过网络分布到多个服务器上(横向伸缩(horizontally
scaled)),用户也可以将 Oracle
数据库迁移到性能更为强劲的小型机(minicomputer)或大型机(mainframe)上(纵向伸缩(vertically scaled))。不论采用那种方案,由于
Oracle 系统具备在不同平台间的移植能力,应用程序基本上无需修改。
-
在网络环境中,数据只存储在服务器上而不是系统中所有计算机上。这使数据并行访问更容易且效率更高。
- 在网络环境中,客户端应用程序使用 SQL
语句向服务器提交数据库访问请求。服务器在接收到 SQL
语句后进行处理,并将处理结果返回客户端应用程序。这只需占用最少的网络通信量,因为在网络间传输的只是用户请求及响应结果(而不是大量用于计算的数据)。
|
011 |
See Also:
|
另见:
|
012 |
Overview of
Multitier Architecture
|
10.2 多层体系结构概述
|
013 |
In a multitier architecture environment, an application server provides
data for clients and serves as an interface between clients and database
servers. This architecture is particularly important because of the
prevalence of Internet use.
|
在一个采用多层体系结构(multitier
architecture)的系统中,客户端与数据库服务器间还存在着为两者交换数据的应用服务器(application
server)。这种体系结构随着 Internet 的流行而变得越发重要。
|
014 |
This architecture enables use of an application server to:
- Validate the credentials of a client,
such as a Web browser
- Connect to a database server
- Perform the requested operation
|
在这种体系结构下,应用服务器(application server)的作用是:
- 验证客户端(比如 web browser)身份
- 连接数据库服务器
- 执行用户提交的请求
|
015 |
An example of a multitier architecture appears in
Figure 10-2.
|
图10-2 展示了一个多层体系结构的例子。
|
016 |
Figure 10-2 A Multitier
Architecture Environment Example
|
图10-2 多层体系结构示例
|
017 |
|
|
018 |
Figure 10-2 shows thin clients sending requests
(arrows going back and forth) to Application Server 1. The
application server shows queries going to database servers and to
other application servers, and data coming back to the application
server from them.
|
图10-2 中,瘦客户端向应用服务器 1
发送请求(图中的双向箭头)。此应用服务器可以将查询发送到数据库或其他应用服务器,并接收返回结果。
|
019 |
Clients
|
10.2.1 客户端
|
020 |
A client initiates a request for an operation to be performed on the
database server. The client can be a Web browser or other end-user
process. In a multitier architecture, the client connects to the
database server through one or more application servers.
|
需要在数据库服务器上执行的操作最初是由客户端提(client)交的。客户端可以是一个 Web 浏览器或其他终端用户进程(end-user
process)。在一个多层体系结构中,客户端需要通过一个或多个应用服务器和数据库服务器通信。
|
021 |
Application Servers
|
10.2.2 应用服务器
|
022 |
An application server provides access to the data for the client. It
serves as an interface between the client and one or more database
servers, which provides an additional level of security. It can also
perform some of the query processing for the client, thus removing some
of the load from the database server.
|
应用服务器负责为客户端访问数据。应用服务器作为客户端与(一个或多个)数据库服务器间的接口,能够提供额外的安全性控制。应用服务器还能为客户端进行一定的数据处理工作,这减轻了数据库服务器的工作负载。
|
023 |
The application server assumes the identity of the client when it is
performing operations on the database server for that client. The
application server's privileges are restricted to prevent it from
performing unneeded and unwanted operations during a client operation.
|
应用服务器的作用是代替客户端在数据库服务器上执行此客户端所需的操作。在应用服务器上进行权限控制就能保证客户端对数据库的操作中不包含不必要及不合法的操作。
|
024 |
Database Servers
|
10.2.3 数据库服务器
|
025 |
A database server provides the data requested by an application server
on behalf of a client. The database server does all of the remaining
query processing.
|
数据库服务器的作用是执行应用服务器为用户提交的数据请求。数据库服务器将继应用服务器之后位用户完成剩余的查询处理操作。
|
026 |
The Oracle database server can audit operations performed by the
application server on behalf of individual clients as well as operations
performed by the application server on its own behalf. For example, a
client operation can be a request for information to be displayed on the
client, whereas an application server operation can be a request for a
connection to the database server.
|
Oracle
数据库服务器能够监控(audit)应用服务器为每个客户端执行的操作,及应用服务器自身对数据库的操作。例如,客户端可能会向数据库请求数据用于展示;而应用服务器会向数据库请求连接。
|
027 |
See Also:
Chapter 20, "Database Security"
|
另见:
第 20 章,“数据库安全”
|
028 |
Overview of
Oracle Net Services
|
10.3 Oracle 网络服务概述
|
029 |
Oracle Net Services provides enterprise-wide connectivity solutions in
distributed, heterogeneous computing environments. Oracle Net Services
enables a network session from a client application to an Oracle
database.
|
Oracle 网络服务(Oracle Net Services)为分布式异构环境提供了一个企业级的互联解决方案。Oracle
网络服务可以在客户端应用程序与数据库服务器间建立网络会话(network session)。
|
030 |
Oracle Net Services uses the communication protocols or application
programmatic interfaces (APIs) supported by a wide range of networks
to provide a distributed database and distributed processing for
Oracle.
- A communication protocol is a set
of rules that determine how applications access the network and
how data is subdivided into packets for transmission across the
network.
- An API is a set of subroutines
that provide, in the case of networks, a means to establish
remote process-to-process communication through a communication
protocol.
|
Oracle 网络服务利用通信协议(communication protocol)或被各种网络支持的 API
来实现分布式数据库(distributed database)及分布式处理(distributed processing)。
- 通信协议是一系列规则,定义了应用程序如何访问网络[例如
TCP 协议],以及数据如何被拆分为数据包(packet)以便在网络上传输[例如
IP 协议]。
- 网络 API
是一系列利用通信协议来实现进程到进程间通信的子程序(subroutine)。
|
031 |
After a network session is established, Oracle Net Services acts as a
data courier for the client application and the database server. It is
responsible for establishing and maintaining the connection between the
client application and database server, as well as exchanging messages
between them. Oracle Net Services is able to perform these jobs because
it is located on each computer in the network.
|
当一个网络会话建立后,Oracle 网络服务就在客户端应用程序与数据库服务器间扮演数据传递者的角色。Oracle
网络服务负责客户端应用程序与数据库服务器间连接的建立与维护,并为二者交换信息。Oracle
网络服务运行在数据库系统中所有的计算机上,因此她能够完成上述工作。
|
032 |
Oracle Net Services provides location transparency, centralized
configuration and management, and quick out-of-the-box installation and
configuration. It also lets you maximize system resources and improve
performance. Oracle's shared server architecture increases the
scalability of applications and the number of clients simultaneously
connected to the database. The Virtual Interface (VI) protocol
places most of the messaging burden on high-speed network hardware,
freeing the CPU for more important tasks.
|
Oracle 网络服务的特点是使系统中的位置信息对用户透明(location
transparency),她还具备集中化的配置管理能力,以及快速地安装与配置能力。Oracle
网络服务使用户能够最大限度的利用系统资源并提高系统性能。Oracle 的共享服务(shared server)体系结构提高了应用程序的可扩展性以及同时连接到数据库的客户端数量。而虚拟接口(Virtual
Interface,VI)协议能够将大部分通信工作交给高速的网络硬件执行,使数据库系统的 CPU 能力用于执行其他任务。
|
033 |
See Also:
Oracle Database Net Services Administrator's Guide for more
information about these features
|
另见:
Oracle Database Net Services Administrator's Guide
了解关于 Oracle 网络服务的更多信息
|
034 |
How Oracle Net Services Works
|
10.3.1 Oracle 网络服务是如何工作的
|
035 |
Oracle's support of industry network protocols provides an interface
between Oracle processes running on the database server and the user
processes of Oracle applications running on other computers of the
network.
|
Oracle 对业界各种网络协议的支持,为运行在数据库服务器上的 Oracle 进程(Oracle process)及在网络中其他计算机上执行
Oracle 应用程序的用户进程(user process)提供了一个完备的接口。
|
036 |
The Oracle protocols take SQL statements from the interface of the
Oracle applications and package them for transmission to Oracle through
one of the supported industry-standard higher level protocols or
programmatic interfaces. The protocols also take replies from Oracle and
package them for transmission to the applications through the same
higher level communications mechanism. This is all done independently of
the network operating system.
|
Oracle 网络协议(Oracle protocol)能够接收 Oracle 应用程序通过接口提交的 SQL
语句,进行封装后利用更高层的标准网络协议或程序接口传输给 Oracle 服务器。Oracle
网络协议还能够从服务器接收回复,并采用相同的机制传输给应用程序。这一切都是由 Oracle 网络服务独立完成的。
|
037 |
Depending on the operation system that runs Oracle, the Oracle Net
Services software of the database server could include the driver
software and start an additional Oracle background process.
|
Oracle 数据库运行的 Oracle 网络服务软件可能包含数据访问驱动程序,还有可能启动额外的 Oracle 后台进程。这和 Oracle
所在的操作系统有关。
|
038 |
See Also:
Oracle Database Net Services Administrator's Guide for more
information about how Oracle Net Services works
|
另见:
Oracle Database Net Services Administrator's Guide
了解关于 Oracle 网络服务如何工作的更多信息
|
039 |
The Listener
|
10.3.2 监听器
|
040 |
When an instance starts, a listener process establishes a
communication pathway to Oracle. When a user process makes a connection
request, the listener determines whether it should use a shared server
dispatcher process or a dedicated server process and establishes an
appropriate connection.
|
当一个实例启动后,一个监听进程(listener process)将与之建立一个通信连接(communication
pathway)。当一个用户进程(user process)发起连接请求时,监听器将决定使用共享服务调度进程(shared server
dispatcher process)或专用服务进程(dedicated server process)为此用户建立连接。
|
041 |
The listener also establishes a communication pathway between databases.
When multiple databases or instances run on one computer, as in Real
Application Clusters, service names enable instances to register
automatically with other listeners on the same computer. A service name
can identify multiple instances, and an instance can belong to multiple
services. Clients connecting to a service do not have to specify which
instance they require.
|
监听器还能在多个数据库间建立通信连接。当多个数据库或实例运行在同一计算机上时(RAC 系统就是如此),每个实例都能够将其服务名(service name)自动地注册到同一计算机上的监听器中。多个实例能使用同一个服务名,一个实例也可以属于多个服务(service)。当客户端通过服务名进行连接时无需指定连接到哪个
Oracle 实例。
|
042 |
Service Information Registration
|
10.3.2.1 服务信息注册
|
043 |
Dynamic service registration reduces the administrative overhead for
multiple databases or instances. Information about the services to which
the listener forwards client requests is registered with the listener.
Service information can be dynamically registered with the listener
through a feature called service registration or statically
configured in the listener.ora file.
|
动态服务注册(dynamic service
registration)功能减少了多数据库或多实例环境下的管理工作。供监听器建立连接的服务(service)的信息能够注册到监听器中。服务信息既可以通过服务注册(service registration)功能动态地注册到监听器,也可以静态地在 listener.ora
文件中进行注册。
|
044 |
Service registration relies on the PMON process—an instance
background process—to register instance information with a listener, as
well as the current state and load of the instance and shared server
dispatchers. The registered information enables the listener to forward
client connection requests to the appropriate service handler. Service
registration does not require configuration in the
listener.ora file.
|
服务注册功能依赖 PMON 进程(PMON process)——实例中一个后台进程——将实例信息注册到监听器,同时被注册的还有实例及共享服务调度器(shared server
dispatcher)的当前状态及工作负载。监听器根据注册信息将客户端连接请求提交给适当的服务。服务注册功能不需要在
listener.ora 文件中进行配置。
|
045 |
The initialization parameter SERVICE_NAMES
identifies which database services an instance belongs to. On startup,
each instance registers with the listeners of other instances belonging
to the same services. During database operations, the instances of each
service pass information about CPU use and current connection counts to
all of the listeners in the same services. This enables dynamic load
balancing and connection failover.
|
实例的初始化参数 SERVICE_NAMES
表明了此实例属于哪个服务。在实例启动时,所有属于同一服务的实例都要注册到为此服务进行监听的所有监听器中。在数据库运行期间,属于同一服务的所有实例要将其
CPU 使用信息及当前用户连接数传递给此服务的所有监听器。这些信息被用于实现动态负载平衡(dynamic load
balancing)及失败连接恢复(connection failover)。
|
046 |
See Also:
|
另见:
|