Usage and Configuration of the Oracle shared Server_数据库

Usage and Configuration of the Oracle shared Server_sed_02

一个客户端连接到服务器时,服务器必须要有进程来对应连接,

Usage and Configuration of the Oracle shared Server_客户端_03

1 对 1, 只要不断开 session

Usage and Configuration of the Oracle shared Server_sed_04

Usage and Configuration of the Oracle shared Server_客户端_05

Usage and Configuration of the Oracle shared Server_sed_06

这个 进程不是 instance 的一部分,是随着client连接而创建,session结束而释放。

当client发个请求时,做工作最多的就是这个 dedicated server process, 它可以与硬盘打交道, 因为它本身就是process。

Usage and Configuration of the Oracle shared Server_数据_07

Usage and Configuration of the Oracle shared Server_数据_08

Usage and Configuration of the Oracle shared Server_客户端_09

在 shared server 中,进程是之前先创建好的,有两类 dispatcher, 和 shared process

dispatcher 会将你的请求放在 SGA 中,然后 shared process 将该请求取出处理,处理完后,将该请求再放回 SGA, dispatcher 将处理的结果取出,那然跟client通信,类似银行,拿号,等待,dispatcher 就类似银行的保安, shared server 相当于柜台的柜员,拿号,就是等着,你的请求会在SGA中等待

Usage and Configuration of the Oracle shared Server_服务器_10

应该先和 listener 连接吧,然后 listener 将该请求给 dispatcher, dispatcher 就是一个传话筒的作用。

Usage and Configuration of the Oracle shared Server_数据库_11

request queue 就一个 ( 不需要知道任务从哪个 session来,工作就是将 request 放入内存的 Request Queue中)

reponse queue 是一个 dispatcher 对应一个( 这个是必须的,因为它要知道这个处理完得任务,对应哪个 session )

Usage and Configuration of the Oracle shared Server_服务器_12

Usage and Configuration of the Oracle shared Server_sed_13

各有优缺点

Usage and Configuration of the Oracle shared Server_sed_14

Usage and Configuration of the Oracle shared Server_数据_15

How a Request is Processed :

1. A user sends a request to its dispatcher.

2. The dispatcher places the request into the request queue in the SGA

3. A shared server picks up the request from the request queue and processes the request.

4. The shared server places the reponse on the calling dispatcher’s response queue.

5. The response is handled off to the dispatcher.

6. The dispatcher returns the reponse to the user.

Request Queue

  • One request queue is shared by all dispatchers.
  • Shared servers monitor the request queue for new requests.
  • Requests are processed on a first-in, first-out( FIFO ) basis.
  • Shared servers place all completed requests on the calling dispatcher’s reponse queue.
  • Each dispatcher has its own reponse queue in the SGA.
  • Each dispatcher is reponsible for sending completed requests back to the appropriate user process.
  • Users are connected to teh same dispathcer for the duration of a session.

Usage and Configuration of the Oracle shared Server_服务器_16

专有服务器 : PGA 是一块大内存,里边存了所有的 server process, 如上图

Usage and Configuration of the Oracle shared Server_服务器_17

Usage and Configuration of the Oracle shared Server_服务器_18

dispatchers 是静态的,不会动态增长

shared server 动态的

Usage and Configuration of the Oracle shared Server_数据_19

Usage and Configuration of the Oracle shared Server_数据库_20

Usage and Configuration of the Oracle shared Server_服务器_21

只要设置了 large_pool_size, UGA 的信息就会放在large pool 里( 用户信息 )

Usage and Configuration of the Oracle shared Server_客户端_22

Usage and Configuration of the Oracle shared Server_数据_23

如果配置了 shared server, 那么就会自动使用 shared server. 优先使用

在客户端来讲,这个对 client 是透明的,也就是 client 不知道服务器时shared server 还是专用服务器

也可以 client 端显示指定,例如上图 在 tnsname.ora 中设置

Usage and Configuration of the Oracle shared Server_sed_24

Usage and Configuration of the Oracle shared Server_sed_25

shared 用的越来越少了,以前 client 非常流行,那个时候没有 3层结构,以前PB的 sysbase 非常强,所以 oracle 推出了 shared 方式

3 层架构,企业做宝贵的是数据, 数据库直接管理数据,所以数据库最好不要直接暴漏给用户,而三层架构有个中间件,所以,3层架构已经占垄断地位了。

Usage and Configuration of the Oracle shared Server_数据_26