ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Enable Shared server on database 11g

Enable Shared server on database 11g

原创 Linux操作系统 作者:jiuniang012 时间:2009-07-11 15:57:52 0 删除 编辑
1. Shared Server 概念和架构
     Oracle数据库服务器进程有两种:Dedicated Server process, Shared Server process. 针对不同的业务类型两种模式各有千秋.
     Dedicated Server Mode(专有服务器模式):
      专有服务器模式中,对于每个连接到数据库实例的用户进程(user processes)都会创建一个专有的服务器进程(Dedicated Server Processes)来处理请求(requests), 并创建一个会话(session).只有当用户进程结束才结束会话并释放资源.
    
     Shared Server Mode(共享服务器模式):
       共享服务器模式中,用户进程并不会和服务器进程直接通信,而是通过分配器(Dispatcher)来协调管理会话连接.当用户创建连接时,由 dispatcher把该连接绑定到vitrual circuit, 让后把这个virtual circuit放到一个公共队列(common queue)里,接着由共享池里空闲的shared server来处理请求,并通过dispatcher把结果返回用户进程. 通过这种共享的方式可以实现'用很少的服务器进程来处理大量的客户连接'.

2. 配置数据库为共享模式
    2.1 共享服务器的初始化参数
   
 Parameter  Description
 SHARED_SERVERS Specifies the initial number of shared servers to start and the minimum number of shared servers to keep. This is the only required parameter for using shared servers.
 MAX_SHARED_SERVERS Specifies the maximum number of shared servers that can run simultaneously.
 SHARED_SERVER_SESSIONS Specifies the total number of shared server user sessions that can run simultaneously. Setting this parameter enables you to reserve user sessions for dedicated servers.
 DISPATCHERS Configures dispatcher processes in the shared server architecture.
 MAX_DISPATCHERS Specifies the maximum number of dispatcher processes that can run simultaneously. This parameter can be ignored for now. It will only be useful in a future release when the number of dispatchers is auto-tuned according to the number of concurrent connections.
 CIRCUITS Specifies the total number of virtual circuits that are available for inbound and outbound network sessions.

  2.2 启动/配置共享服务器模式
         配置为共享服务器模式只需要设置SHARED_SERVERS参数为非零值. 其它参数为可选参数.
         由于共享服务器模式至少需要一个dispatcher,因此不配置DISPATCHERS参数也会默认自动创建一个DISPATCHER.
         设置方法:
         1. 设置SHARED_SERVERS于初始化参数文件里.
         2. 动态的切换为共享服务器模式.
             SQL> ALTER SYSTEM SET SHARED_SERVERS=10;

         注: 如果在初始化参数文件里没有设置SHARED_SERVERS参数,但设置了DISPATCHERS参数,则数据库启动后将处于共享服务器模式,并自动设置SHARED_SERVERS=1.
               然而,如果在初始化参数文件里没有设置SHARED_SERVERS, DISPATCHERS参数,启动数据库后并不能通过设置DISPATCHERS参数来自动设置为共享服务器模式.
   2.3 配置DISPATCHERS
          共享服务器模式中至少要一个DISPATCHER.如果通过设置SHARED_SERVERS为非零值(并没设置DISPATCHERS参数),系统将自动创建一个PROTOCAL=TCP的DISPATCHER.
          DISPATCHERS的初始化参数属性:
         
 Attributes  Description
 ADDRESS  Specify the network protocol address of the endpoint on which the dispatchers listen.
 DESCRIPTION  Specify the network description of the endpoint on which the dispatchers listen, including the network protocol address. The syntax is as follows:
(DESCRIPTION=(ADDRESS=...))
 PROTOCOL  Specify the network protocol for which the dispatcher generates a listening endpoint.
 For example:
(PROTOCOL=tcp) (PROTOCOL-tcps)
 DISPATCHERS  Specify the initial number of dispatchers to start.
 CONNECTIONS  Specify the maximum number of network connections to allow for each dispatcher.
 SESSIONS  Specify the maximum number of network sessions to allow for each dispatcher.
 TICKS  

Specify the duration of a TICK in seconds. A TICK is a unit of time in terms of which the connection pool timeout can be specified. Used for connection pooling.
 LISTENER  Specify an alias name for the listeners with which the PMON process registers dispatcher information. Set the alias to a name that is resolved through a naming method.
 MULTIPLEX  Used to enable the Oracle Connection Manager session multiplexing feature.
 POOL  Used to enable connection pooling.
 SERVICE  Specify the service names the dispatchers register with the listeners.
  
        
     2.4 关闭DISPATCHER 进程
     SQL> SELECT NAME, NETWORK FROM V$DISPATCHER;
     SQL> ALTER SYSTEM SHUTDOWN IMMEDIATE 'D002';


3. 关闭共享服务器模式
    关闭共享服务器模式只需要设置SHARED_SERVERS=0. 此时没有新的用户可以连接到共享服务器模式. 然而,当设置SHARED_SERVERS=0后,仍然会保留shared server直到用户退出连接. 保留的shared server的数量和前面设置的SHARED_SERVERS, MAX_SHARED_SERVERS的值中较小的那个值一样,如果此时MAX_SHARED_SERVERS也设置为0,所以的shared server都会被终止,剩下的请求将会被保存到队列里,直到SHARED_SERVERS, MAX_SHARED_SERVERS参数被重新设置非零值.
    当所以的用户连接都断开后执行:
    SQL> ALTER SYSTEM SET DISPATCHERS='';

4. 和共享服务器模式相关的视图(见附件)

admin013.gif

admin011.gif

Snap1.jpg

Snap2.jpg

Snap3.jpg

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9466564/viewspace-608901/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Logminer 用法
请登录后发表评论 登录
全部评论

注册时间:2009-07-02

  • 博文量
    126
  • 访问量
    211248