oracle Basic Oracle Net server-side configuration_长连接

前4点比较重要,最后1点没用

server 端的配置

oracle Basic Oracle Net server-side configuration_ip地址_02

listener是一个进程,等待用户请求,特点:如下图

oracle Basic Oracle Net server-side configuration_中间件_03

listener 类似看大门的老大爷,他只是传话的,不是干活的,所以当他的到消息后,会传递出去

oracle Basic Oracle Net server-side configuration_ip地址_04

如果是 dedicated server 就会生成一个独立的进程( dedicated server process ),然后 listener 把该任务交给这个新生成的进程, 所以每个任务都会生成独立的进程来处理。

如果是 shared server 就不单独创建进程了,而是将管理权交给 dispatcher or server process

oracle Basic Oracle Net server-side configuration_ip地址_05

在演示中看到了,会生成很多新的进程

oracle Basic Oracle Net server-side configuration_重定向_06

windows 基本上不用

oracle Basic Oracle Net server-side configuration_ip地址_07

oracle Basic Oracle Net server-side configuration_服务器_08

注意上边是 Bequeath Session, 不是普通的 session, 参考如下:

The listener may spawn dedicated server processes as connection requests are received and bequeath(or pass) the connections to the server processes. The use of this method is dependant on the ability of the underlying operating system to support inheritance of network endpoints. When the listener forks a dedicated server process and bequeaths the connection to the server process, it is called a bequeath session. The following sequence of events occurs:

1. The client establishes a connection to the listener using the configured protocol and sends the listener a connect packet. ( client request )

2. The listener checks that the SID is defined, if it is, the listener will fork or spawn a new process to deal with the connection. A bequeath connection is then established between the listener and the new server process to pass process initialisation information. The bequeath connection is then closed. Please note that the TCP socket is inherited by the new server process.

3. The server process sends a resend packet back to the client. ( 请求client再次发送 )

4. A new CONNECT packet is then sent to the newly forked dedicated server process

5. The dedicated server process accepts the incoming connection and forwards a ACCEPT message back to the client.

When conditions do not support the establishment of a bequeath or direct hand off connection, a redirect session will be established.

 

oracle Basic Oracle Net server-side configuration_长连接_09

 

由于 只传递了 port 没有传递 IP 地址,所以就把 listener的IP地址作为默认的服务器IP地址,所以这种情况就不能把 listener 和 server放在不同的PC上

oracle Basic Oracle Net server-side configuration_重定向_10

这里的重定向是指端口重定向 ( 换端口进行通信 )

1. 客户请求

2. 也是派生出新的进程来管理客户请求

3. 新的进程找到了新的 TCP/IP 端口( 空闲的 ) 传递给 listener

4. listener 会将新的 port 和信息 发送给 client

5. 新的 tcp/ip 会建立在 client 和 新的 process

6. 服务器响应客户端请求

oracle Basic Oracle Net server-side configuration_长连接_11

中间件可以作为服务器的 客户端,因为 TCP/IP 连接比较昂贵(耗时)

通常,采用中间件与服务器的长连接,长期维持连接,例如连接池,但是,client与中间件不是长连接,而且中间件与服务器之间一般都是1000M以上的局域网

listener 的配置,分为静态和动态

oracle Basic Oracle Net server-side configuration_重定向_12

pmon每过 60秒 都要去 listener 去看一下,是否需要 pmon 服务,这就是 Dynamic service registration, 不过这种模式比较低效

第二种,类似留纸条,就不需要每次都跑过去 listener 去看了,这就是 static service configuration.

oracle Basic Oracle Net server-side configuration_ip地址_13

net manager 可以配置 listener.ora

例子:

oracle Basic Oracle Net server-side configuration_ip地址_14

oracle Basic Oracle Net server-side configuration_服务器_15

oracle Basic Oracle Net server-side configuration_ip地址_16

gloable name = db_name.db_domain

要使用OEM 就必须要静态注册

oracle Basic Oracle Net server-side configuration_服务器_17

oracle Basic Oracle Net server-side configuration_中间件_18

oracle Basic Oracle Net server-side configuration_服务器_19

oracle Basic Oracle Net server-side configuration_中间件_20

oracle Basic Oracle Net server-side configuration_长连接_21

oracle Basic Oracle Net server-side configuration_重定向_22

oracle Basic Oracle Net server-side configuration_服务器_23

oracle Basic Oracle Net server-side configuration_长连接_24