之前整理的相关链接:
Oracle 监听(Listener) 中services 说明
http://blog.csdn.net/tianlesoftware/article/details/6617827
http://blog.csdn.net/tianlesoftware/article/details/5543166
OracleDedicated server 和Shared server(专用模式 和 共享模式) 说明
http://blog.csdn.net/tianlesoftware/article/details/5695784
官网的链接:
http://docs.oracle.com/cd/E11882_01/server.112/e25789/dist_pro.htm#sthref1975
Oracle Net Services is a suite of networking components thatprovides enterprise-wide connectivity solutions in distributed, heterogeneouscomputing environments. Oracle Net Services enables a network session from anapplication to a database instance anda database instance to another database instance.
--Oracle Net Services 是由一系列networking components,NetServices 提供distributed 和 heterogeneous 的计算环境,允许应用通过networksession 连到instance 和一个instance 连接另一个instance。
Oracle NetServices provides location transparency, centralized configuration andmanagement, and quick installation and configuration. It also lets you maximizesystem resources and improve performance. The Oracle Database sharedserver architecture increases the scalability of applications and thenumber of clients simultaneously connected to the database. The VirtualInterface (VI) protocol places most of the messaging burden on high-speednetwork hardware, freeing the CPU.
Oracle NetServices uses the communication protocols or application programmaticinterfaces (APIs) supported by a wide range of networks to provide distributeddatabase and distributed processing. After a network session is established,Oracle Net Services acts as a data courier for the client application and thedatabase server, establishing and maintaining a connection and exchangingmessages. Oracle Net Services can perform these tasks because it exists on eachcomputer in the network.
--Oracle Net Services 使用通信协议或者API 来连接。 当一个networksession 连接之后,Net Services就起中间人的作用,负责维护客户端的应用和数据库的连接,并交换数据。
一. How Oracle Net Services Works
Oracle Databaseprotocols take SQL statements from the interface of the Oracle applications andpackage them for transmission to Oracle Database through a supportedindustry-standard higher level protocol or API.Replies from Oracle Database are packaged through the same higher levelcommunications mechanism. This work occurs independently of the networkoperating system.
Depending on theoperating system that runs Oracle Database, the Oracle Net Services software ofthe database server could include the driver software and start an additionalbackground process.
二.The Oracle Net Listener
The Oracle Net Listener, also called the listener, is aserver-side process that listens for incoming client connection requests andmanages traffic to the database. When a database instance starts, and at various timesduring its life, the instance contacts a listener and establishes acommunication pathway to this instance.
--Oracle Net Listener 也叫listener,它是一个服务端的进程,负责监听管理客户端连过来的请求。
Serviceregistration enables the listener to determine whether a database serviceand its service handlers are available. A service handler is adedicated serverprocess or dispatcher that acts as a connection point to a database. Duringregistration, the PMON process provides the listener with the instance name,database service names, and the type and addresses of service handlers. Thisinformation enables the listener to start a service handler when a clientrequest arrives.
--Server registration 启用listener 是否处理databaseservice,及其service handlers 是否可用,service handler 是一个dedicatdserver process 或者 dispatcher。 在注册时,PMON 进程会提供instance name,databaseservice names 和 service handler 的类型及地址。 这些信息允许listener在client 请求时,启动一个service handler。
Figure16-3 shows two databases, each on a separate host. The databaseenvironment is serviced by two listeners, each on a separate host. The PMONprocess running in each database instance communicates with both listeners toregister the database.
Figure16-4 shows a browser making an HTTP connection and a client making adatabase connection through a listener. The listener does not need to reside onthe database host.
--当通过HTTP连接到数据库时,就不需要listener。
The basic steps by which a clientestablishes a connection through a listener are:
--客户端连接到listener的基本步骤:
1.A clientprocess or another database requests a connection.
2.The listener selects an appropriateservice handler to service the client request and forwards the request to thehandler.
3.The client process connects directly tothe service handler. The listener is no longer involved in the communication.
--当接收到请求之后,listener会创建一个service handler,当创建成功之后,client 进程直接连接到handler上,就不需要在和listener交互了,因此我们stop listener 不影响已经连接上的进程。
三. ServiceNames
In the contextof net services, a service is a set of one or more databaseinstances. A service name is a logical representation of a serviceused for client connections.
When a clientconnects to a listener, it requests a connection to a service. When a databaseinstance starts, it registers itself with a listener as providing one or moreservices by name. Thus, the listener acts as a mediator between the client andinstances and routes the connection request to the right place.
--客户端需要通过service 来连接到listener,当instance启动后,PMON会把service 信息自动注册到监听里。
A singleservice, as known by a listener, can identify one or more database instances.Also, a single database instance can register one or more services with alistener. Clients connecting to a service need not specify which instance theyrequire.
一个service 可以对应多个instance,同样,一个instance也可以对应多个services。 客户端连接到service 时不需要指定具体的instance。
Figure16-5 shows one single-instance database associated with twoservices, book.example.com and soft.example.com. The services enable the same database to be identifieddifferently by different clients. A database administrator can limit orreserve system resources, permitting better resource allocation to clientsrequesting one of these services.
--在下图中,一个instance 分配给了2个services。
四.Service Registration
Serviceregistration is a feature by which the PMON process dynamically registersinstance information with a listener, which enables the listener to forwardclient connection requests to the appropriate service handler. PMON providesthe listener with information about the following:
--PMON 进程会动态的instance 信息注册到listener里,之后listener就可以接收客户端的请求并分配service handler。 PMON 注册时提供了如下信息:
(1)Names of thedatabase services provided by the database
(2)Name of thedatabase instance associated with the services and its current and maximum load
(3)Servicehandlers (dispatchers and dedicated servers) available for the instance,including their type, protocol addresses, and current and maximum load
Serviceregistration is dynamic and does not require configuration inthe listener.ora file. Dynamic registration reduces administrativeoverhead for multiple databases or instances.
--Service registration 是动态进行,不需要配置listener.ora 文件。
The initializationparameter SERVICE_NAMES lists the services an instance belongs to. Onstartup, each instance registers with the listeners of other instancesbelonging to the same services. During database operations, the instances ofeach service pass information about CPU use and current connection counts toall listeners in the same services. This communication enables dynamic loadbalancing and connection failover.
初始化参数service_names 保存了instance对应的services,在instance启动时,会把同一个service的对应的instance 注册到listener里。 每个service的instance注册时包含CPU和当前连接的数量。
五. Dedicated Server Architecture
In a dedicated server architecture, the server process created on behalf ofeach client process is called a dedicated serverprocess (or shadow process). This server process is separatefrom the client process and acts only on its behalf, as shown in Figure16-6.
--在Dedicated 模式下,每个客户端的连接都会创建一个dedicatedserver process。 每个server process 仅供一个client process使用。
A one-to-oneratio exists between the client processes and server processes. Even when theuser is not actively making a database request, the dedicated server processremains—although it is inactive and can be paged out on some operating systems.
--client和server 是一对一的映射,即使user 不是活跃的,serverprocess 仍然存在,虽然它的状态是inactive ,并且可以被paged out。
Figure16-6 shows user and server processes running on networked computers.However, the dedicated server architecture is also used if the same computerruns both the client application and the database code but the host operatingsystem could not maintain the separation of the two programs if they were runin a single process. Linux is an example of such an operating system.
In the dedicated server architecture, the user and server processes communicate using differentmechanisms:
--在dedicated server 架构下,user 和 server之间的交互使用不同的机制:
(1)If the clientprocess and the dedicated server process run on the same computer, then theprogram interface uses the host operating system's interprocess communicationmechanism to perform its job.
--如果client 和 server 在同一台机器上,那么程序接口使用操作系统进程间的通信机制来执行工作。因此对于服务器本上的连接,可以不用通过listener。
(2)If the clientprocess and the dedicated server process run on different computers, then theprogram interface provides the communication mechanisms (such as the networksoftware and Oracle Net Services) between the programs.
--如果client 和 server 在不同的机器上,那么程序接口就使用Net Services 等通信机制。这种情况下必须启动listener。
Unde rutilizeddedicated servers sometimes result in inefficient use of operating systemresources. Consider an order entry system with dedicated server processes. Acustomer places an order as a clerk enters the order into the database. Formost of the transaction, the clerk is talking to the customer while the serverprocess dedicated to the clerk's client process is idle. The server process isnot needed during most of the transaction, and the system may be slower forother clerks entering orders if the system is managing too many processes. Forapplications of this type, the shared server architecture may be preferable.
六. SharedServer Architecture
In a sharedserver architecture, a dispatcher directs multiple incoming network sessionrequests to a pool of shared server processes, eliminating the need for adedicated server process for each connection. An idle shared server processfrom the pool picks up a request from a common queue.
--在shared server 架构下,dispatcher 直接请求指向sharedserver process pool。空闲的shared server process 就会分配给请求,这样就可以避免每个client 分配一个进程。
The potential benefits of shared server areas follows:
--使用sharedserver 有以下好处:
(1)Reduces the number of processes onthe operating system
--减少processes 的数量
A small numberof shared servers can perform the same amount of processing as many dedicated servers.
(2)Reduces instance PGA memory
--减少实例PGA的大小
Every dedicatedor shared server has a PGA. Fewer server processes means fewer PGAs and lessprocess management.
--每个dedicated 或者shared server 都需要分配PGA,那么少的的serverproceses 就会减少PGA的大小。
(3)Increases application scalabilityand the number of clients that can simultaneously connect to the database
(4)May be faster than dedicated serverwhen the rate of client connections and disconnections is high
Shared server has several disadvantages, including slower response time in some cases, incomplete featuresupport, and increased complexity for setup and tuning. As a general guideline,only use shared server when you have more concurrent connections to thedatabase than the operating system can handle.
--shared server 也有一些缺点,如在一些案例中response 比较慢,一些特性不支持,增加setup 和tuning 的负责度。 一般仅当有很多并发连接时才使用sharedserver。
The following processes are needed in ashared server architecture:
--shared server 架构下需要如下进程:
(1)A network listener that connectsthe client processes to dispatchers or dedicated servers (the listener is partof Oracle Net Services, not Oracle Database)
Note:
To use shared servers, a client process must connect through OracleNet Services, even if the process runs on the same computer as the Oracle Databaseinstance.
(2)One or more dispatcherprocess (Dnnn)
(3)One or more shared server processes
Note that adatabase can support both shared server and dedicated server connectionssimultaneously. For example, one client can connect using a dedicated serverwhile a different client connects to the same database using a shared server.
--DB 可以同时支持shared server 和dedicated server。
6.1 Dispatcher Request and Response Queues
A request from auser is a single API call that is part of the user's SQL statement. When a usermakes a call, the following actions occur:
--当用户发送请求时,发生如下动作:
(1)The dispatcher places the requeston the request queue, where it is picked up by the next available sharedserver process.
The requestqueue is in the SGA and is common to all dispatcher processes of an instance(see "LargePool").
--dispatcher 在request 队列里请求一个位置。 Request 队列在SGA中,其对实例的所有dispatcher 进程共享。
(2)The shared server processes checkthe common request queue for new requests, picking up new requests on afirst-in-first-out basis.
--shared server 进程检查common request 队列,根据先进先出的原则,取得一个request。
(3)One shared server process picks upone request in the queue and makes all necessary calls to the database tocomplete this request.
--当shared server process 从队列中获取到一个请求之后,就会分配所有可用的calls 来完成这个请求。
A differentserver process can handle each database call. Therefore, requests to parse aquery, fetch the first row, fetch the next row, and close the result set mayeach be processed by a different shared server.
--不同的server 进程可以handle不同的call。
(4)When the server process completesthe request, it places the response on the calling dispatcher's responsequeue. Each dispatcher has its own response queue.
--当server process 处理完这个请求,这个请求就放到dispatcher’sresponse queue. 每个dispatcher 有自己的response queue。
(5)The dispatcher returns thecompleted request to the appropriate client process.
--dispatcher 返回完成的请求到对应的客户进程。
For example, inan order entry system, each clerk's client process connects to a dispatcher.Each request made by the clerk is sent to this dispatcher, which places therequest in the queue. The next available shared server picks up the request,services it, and puts the response in the response queue. When a request iscompleted, the clerk remains connected to the dispatcher, but the shared serverthat processed the request is released and available for other requests. Whileone clerk talks to a customer, another clerk can use the same shared serverprocess.
Figure16-7 shows how client processes communicate with the dispatcher acrossthe API and how the dispatcher communicates user requests to shared serverprocesses.
6.2 Dispatcher Processes (Dnnn)
The dispatcherprocesses enable client processes to share a limited number of serverprocesses. You can createmultiple dispatcher processes for a single database instance. The optimumnumber of dispatcher processes depending on the operating system limitation andthe number of connections for each process.
--dispatch 进程允许客户端进程共享有限的server processes。可以在一个instance 上创建多个dispatchprocesses。
Note:
Each client processthat connects to a dispatcher must use Oracle Net Services, even if bothprocesses run on the same host.
在shared server 模式下,所有连接到dispatcher 的客户端进程都必须使用Net Services,即使在同一台机器上。
Dispatcher processes establishcommunication as follows:
--Dispatch 进程通过以下方式建立通信:
(1)When aninstance starts, the network listener process opens and establishes acommunication pathway through which users connect to Oracle Database.
--当实例启动之后,network listener 进程打开和建立一个连接到DB的路径。
(2)Eachdispatcher process gives the listener process an address at which thedispatcher listens for connection requests.
At least onedispatcher process must be configured and started for each network protocolthat the database clients will use.
--每一个dispatcher 进程会把客户端请求的地址传给listener 进程。每个实例至少需要一个dispatcher 进程。
(3)When a clientprocess makes a connection request, the listener determines whether the clientprocess should use a shared server process:
当一个client 进程发送一个connection请求时,listener 决定client 进程使用的share server process:
1) If the listener determines thata shared server process is required, then the listener returns the address ofthe dispatcher process that has the lightest load, and the client processconnects to the dispatcher directly.
--如果listener 决定使用shared server process,那么listener将返回负载最小的dispatcher 进程的地址,client 直接连接到这个dispatcher上。
2)If the process cannot communicatewith the dispatcher, or if the client process requests a dedicated server, thenthe listener creates a dedicated server and establishes an appropriateconnection.
--如果进程不能和dispatcher 通信,或者client process 请求的是一个dedicatedserver,那么listener 将创建一个dedicated server,然后建立连接。
6.3 Shared ServerProcesses (Snnn)
Each sharedserver process serves multiple client requests in the shared server configuration. Shared and dedicated serverprocesses provide the same functionality, except shared server processes arenot associated with a specific client process. Instead, a shared server processserves any client request in the shared server configuration.
--在shared server 模式下, 每个share server process 服务于多个clientrequest。 这点上share 和dedicated serverprocesses 是相同的。
The PGA of ashared server process does not contain UGA data, which must be accessible toall shared server processes. The shared server PGA contains onlyprocess-specific data.
--shared server process 的PGA 不包含UGA的数据,UGA的数据必须能被所有的shared server processes进程访问。 Share serverPGA 仅包含进程指定的数据。
Allsession-related information is contained in the SGA. Each shared server processmust be able to access all sessions' data spaces so that any server can handlerequests from any session. Space is allocated in the SGA for each session'sdata space.
--所有session 相关的数据都存放在SGA中,每一个sharedserver 进程必须能被所有session的date 访问。 因此任何一个server才可以处理任何一个session 的请求。每个session 的data 空间在SGA中分配。
6.4 Restricted Operations of the Shared Server
Certain administrative activities cannotbe performed while connected to a dispatcher process, including shutting downor starting an instance and media recovery. These activities are typicallyperformed when connected with administratorprivileges. To connect with administrator privileges in a system configuredwith shared servers, you must specify that you want to use a dedicated serverprocess.
--在share server 模式下,连接到dispatcher 的进程不能执行管理员的一些操作,包括shutdown, startup 和 介质恢复操作。 这些操作必须用dedicatedserver 模式连接。
七.Database Resident Connection Pooling
Database Resident Connection Pooling (DRCP) provides aconnection pool of dedicated servers for typical Web application scenarios. AWeb application typically makes a database connection, uses the connectionbriefly, and then releases it. Through DRCP, the database can scale to tens ofthousands of simultaneous connections.
--DRCP 是dedicated server下为web 应用分配的一个连接池。web 应用简单的和db 建立连接,然后释放session。 通过DRCP ,DB 可以同时支持数万的连接。
DRCP provides the following advantages:
--通过DRCP 有如下好处:
(1)Complements middle-tier connectionpools that share connections between threads in a middle-tier process.
--补充middle-tier 的连接池,在middle-tier 进程的线程内共享连接。
(2)Enables database connections to beshared across multiple middle-tier processes. These middle-tier processes maybelong to the same or different middle-tier host.
--是数据库连接可以在middle-tier 进程中共享,middle-tier 进程可以属于相同或者不同的主机。
(3)Enables a significant reduction inkey database resources required to support many client connections. Forexample, DRCP reduces the memory required for the database and boosts thescalability of the database and middle tier. The pool of available servers alsoreduces the cost of re-creating client connections.
--在多client 连接时减少DB 资源的需求。
(4)Provides pooling for architectureswith multi-process, single-threaded application servers, such as PHP andApache, that cannot do middle-tier connection pooling.
--为multi-proces,single-threaded 应用服务提供pooling,如PHP,apache。 这些不能使用middle-tier 连接pooling。
DRCP usesa pooled server, which is the equivalent of a dedicated server process(not a shared server process) and a database session combined. The pooledserver model avoids the overhead of dedicating a server for every connectionthat requires the server for a short period.
DRCP 使用pooled server,它等同于dedicated serverprocess。
Clientsobtaining connections from the database resident connection pool connect to anOracle background process known as the connection broker. The connectionbroker implements the pool functionality and multiplexes pooled servers amonginbound connections from client processes.
--client 从db 连接池中获取连接,然后连接到oracle 后台进程的过程叫做connection broker。
As shownin Figure16-8, when a client requires database access, the connection broker picksup a server process from the pool and hands it off to the client. The client isdirectly connected to the server process until the request is served. After theserver has finished, the server process is released into the pool. Theconnection from the client is restored to the broker.
In DRCP,releasing resources leaves the session intact, but no longer associated with a connection(server process). Unlike in shared server, this session stores its UGA in thePGA, not in the SGA. A client can reestablish a connection transparently upondetecting activity.
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Email: tianlesoftware@gmail.com
Skype: tianlesoftware
Blog: http://www.tianlesoftware.com
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook:http://www.facebook.com/tianlesoftware
-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----
DBA1 群:62697716(满); DBA2 群:62697977(满) DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群:83829929 DBA5群: 142216823
DBA6 群:158654907 DBA7 群:172855474